From fc3b4e3d35ae3c1cfa423b1eaddf6592e19deb24 Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Sun, 9 Jun 2024 11:10:55 +1200 Subject: [PATCH] module-bluez5-device: make SBC decode errors non-fatal. SBC frames are aligned with buffer boundaries. If SBC decoding fails, it's usually the case that the next buffer will decode just fine, and we can skip the one we've received. This was tested with streaming A2DP audio from a Galaxy A15S. PulseAudio reported: Jun 08 16:13:07.829247 round-3in pulseaudio[501]: SBC decoding error (-2) Jun 08 16:13:07.829459 round-3in pulseaudio[501]: Decoding error ... Jun 08 16:58:26.729742 round-3in pulseaudio[501]: SBC decoding error (-3) Jun 08 16:58:26.729901 round-3in pulseaudio[501]: Decoding error These would normally be fatal errors, but the audio stream recovered and continued with this change. --- src/modules/bluetooth/module-bluez5-device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index a4da77606..a1201f028 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -588,11 +588,8 @@ static int bt_process_push(struct userdata *u) { pa_memblock_release(memchunk.memblock); - if (processed != (size_t) received) { + if (processed != (size_t) received) pa_log_error("Decoding error"); - pa_memblock_unref(memchunk.memblock); - return -1; - } u->read_index += (uint64_t) memchunk.length; #ifdef USE_SMOOTHER_2 -- 2.43.0