mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
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>
This commit is contained in:
parent
7d191b64d9
commit
976fc1d099
1 changed files with 10 additions and 2 deletions
|
|
@ -170,8 +170,16 @@ static size_t encode_buffer(void *codec_info, uint32_t timestamp, const uint8_t
|
||||||
frame->padding = 0x00;
|
frame->padding = 0x00;
|
||||||
|
|
||||||
if (PA_UNLIKELY(encoded <= 0)) {
|
if (PA_UNLIKELY(encoded <= 0)) {
|
||||||
pa_log_error("SBC encoding error (%li)", (long) encoded);
|
pa_log_error("SBC encoding error (%li) for input size %lu, SBC codesize %lu",
|
||||||
return -1;
|
(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);
|
pa_assert_fp((size_t) encoded == sbc_info->codesize);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue