bluez5: media-source: support codec-provided packet loss concealment

If packet sequence number jumps ahead, or we would underflow, use
codec-provided packet loss concealment to produce some audio data.

When we produce it during underflow, skip the corresponding number of
sequence numbers of future packets.

If codec doesn't have PLC, keep the previous behavior (pad with zeros,
buffering pauses to wait for data).
This commit is contained in:
Pauli Virtanen 2025-06-13 23:41:17 +03:00 committed by Wim Taymans
parent d0680a2b3d
commit 90a1b35017
2 changed files with 141 additions and 83 deletions

View file

@ -168,6 +168,11 @@ static inline void *spa_bt_decode_buffer_get_write(struct spa_bt_decode_buffer *
return SPA_PTROFF(this->buffer_decoded, this->write_index, void);
}
static inline size_t spa_bt_decode_buffer_get_size(struct spa_bt_decode_buffer *this)
{
return this->write_index - this->read_index;
}
static inline void spa_bt_decode_buffer_write_packet(struct spa_bt_decode_buffer *this, uint32_t size, uint64_t nsec)
{
int32_t remain;