summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor V. Kovalenko <igor.v.kovalenko@gmail.com>2021-03-03 23:13:52 +0300
committerPulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org>2021-04-05 15:43:32 +0000
commit976fc1d099d1123e8084cbcf996214442178f5a6 (patch)
treea6ab80cc3130bcea11f1543c5f31f2a7185e6ef1
parent7d191b64d978483839cee8ca2176ac6970b1c3f3 (diff)
bluetooth: mSBC: ignore empty encoded frame
If input block size is shorter than SBC frame codesize, encoder will return 0. Log this and skip whole input block. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>
-rw-r--r--src/modules/bluetooth/bt-codec-msbc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/modules/bluetooth/bt-codec-msbc.c b/src/modules/bluetooth/bt-codec-msbc.c
index 107e0673f..c49a0f947 100644
--- a/src/modules/bluetooth/bt-codec-msbc.c
+++ b/src/modules/bluetooth/bt-codec-msbc.c
@@ -170,8 +170,16 @@ static size_t encode_buffer(void *codec_info, uint32_t timestamp, const uint8_t
frame->padding = 0x00;
if (PA_UNLIKELY(encoded <= 0)) {
- pa_log_error("SBC encoding error (%li)", (long) encoded);
- return -1;
+ pa_log_error("SBC encoding error (%li) for input size %lu, SBC codesize %lu",
+ (long) encoded, input_size, sbc_get_codesize(&sbc_info->sbc));
+
+ if (encoded < 0) {
+ *processed = 0;
+ return -1;
+ } else {
+ *processed = input_size;
+ return 0;
+ }
}
pa_assert_fp((size_t) encoded == sbc_info->codesize);