mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
bluetooth: Fix usage of MTU, buffer sizes and return values of encode/decode methods
Add explanation why minimal bitpool value is used in SBC codec as initial bitpool value for A2DP source. Set buffer size for reading/writing from/to A2DP socket to exact link MTU value. This would ensure that A2DP codec does not produce larger packet as maximal possible size which can be sent. Because A2DP socket is of SOCK_SEQPACKET type, it is guaranteed that we do not read two packets via one read/recvmsg call. Properly check for all return values of encode/encode methods of A2DP codec functions. They may fail at different levels. Also encode or decode API method may return zero length buffer (e.g. because of algorithmic delay of codec), so do not fail in this case.
This commit is contained in:
parent
3929798a53
commit
018b38ec39
3 changed files with 67 additions and 31 deletions
|
|
@ -72,9 +72,11 @@ typedef struct pa_a2dp_codec {
|
|||
/* Reset internal state of codec info data in codec_info */
|
||||
void (*reset)(void *codec_info);
|
||||
|
||||
/* Get read block size for codec */
|
||||
/* Get read block size for codec, it is minimal size of buffer
|
||||
* needed to decode read_link_mtu bytes of encoded data */
|
||||
size_t (*get_read_block_size)(void *codec_info, size_t read_link_mtu);
|
||||
/* Get write block size for codec */
|
||||
/* Get write block size for codec, it is maximal size of buffer
|
||||
* which can produce at most write_link_mtu bytes of encoded data */
|
||||
size_t (*get_write_block_size)(void *codec_info, size_t write_link_mtu);
|
||||
|
||||
/* Reduce encoder bitrate for codec, returns new write block size or zero
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue