bluez5: account for codec internal delay in latency values

Encoders and some decoders have additional internal latency that needs
to be accounted for.

This mostly matters for AAC (~40ms), as the other BT codecs have much
lower delays (~5ms).
This commit is contained in:
Pauli Virtanen 2024-02-23 21:04:47 +02:00 committed by Wim Taymans
parent 1b3b577b8f
commit 2d30ab94c2
10 changed files with 151 additions and 10 deletions

View file

@ -554,6 +554,14 @@ static int duplex_decode(void *data,
return res;
}
static void codec_get_delay(void *data, uint32_t *encoder, uint32_t *decoder)
{
if (encoder)
*encoder = 73;
if (decoder)
*decoder = 0;
}
/* Voice channel SBC, not a real A2DP codec */
static const struct media_codec duplex_codec = {
.codec_id = A2DP_CODEC_VENDOR,
@ -590,7 +598,8 @@ static const struct media_codec duplex_codec = {
.start_encode = codec_start_encode, \
.encode = codec_encode, \
.reduce_bitpool = codec_reduce_bitpool, \
.increase_bitpool = codec_increase_bitpool
.increase_bitpool = codec_increase_bitpool, \
.get_delay = codec_get_delay
const struct media_codec a2dp_codec_faststream = {
FASTSTREAM_COMMON_DEFS,