bluez5: support packet loss concealment in codecs

LC3 and Opus have built-in support for packet loss concealment.

Add codec interface for that, and implement for LC3.

Extend media_codec interface so that packets not aligned with socket
reads can be handled, as in HFP. This is required for correct sequence
number counting, and for being able to run codec PLC *before* decoding
the next correctly received packet.
This commit is contained in:
Pauli Virtanen 2025-06-13 20:53:49 +03:00 committed by Wim Taymans
parent a2ede93479
commit d0680a2b3d
5 changed files with 76 additions and 5 deletions

View file

@ -193,8 +193,9 @@ static int codec_decode(void *data,
this->data = NULL;
if (res < 0) {
h2_reader_init(&this->h2, true);
return res;
/* fail decoding silently, so remainder of packet is processed */
spa_log_debug(log_, "decoding failed: %d", res);
return consumed;
}
return consumed;
@ -222,6 +223,7 @@ const struct media_codec hfp_codec_msbc = {
.decode = codec_decode,
.name = "msbc",
.description = "MSBC",
.stream_pkt = true,
};
MEDIA_CODEC_EXPORT_DEF(