[pulseaudio-discuss] [RFC PATCH] bluetooth: Fix assertion failure (decoded == a2dp->frame_length)
Tanu Kaskinen
tanuk at iki.fi
Sun Oct 14 11:03:40 PDT 2012
On Wed, 2012-10-10 at 09:17 +0200, David Henningsson wrote:
> According to the patch author, Karl Hegbloom:
> "The assertion is incorrectly testing for '==' when logically it
> should test for '<='."
>
> BugLink: https://bugs.launchpad.net/bugs/689915
> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
> ---
>
> This is a patch I found attached to a bug in Ubuntu. I don't know
> much about bluetooth, and the error was reported against something
> around 0.9.22. But I'm sending it here, hoping that one of our
> bluetooth people can review and say whether this is correct or not.
>
> src/modules/bluetooth/module-bluetooth-device.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index e3ec6ae..06c783d 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -999,9 +999,9 @@ static int a2dp_process_push(struct userdata *u) {
> a2dp->frame_length = sbc_get_frame_length(&a2dp->sbc);
>
> pa_assert_fp((size_t) decoded <= to_decode);
> - pa_assert_fp((size_t) decoded == a2dp->frame_length);
> + pa_assert_fp((size_t) decoded <= a2dp->frame_length);
>
> - pa_assert_fp((size_t) written == a2dp->codesize);
> + pa_assert_fp((size_t) written <= a2dp->codesize);
>
> p = (const uint8_t*) p + decoded;
> to_decode -= decoded;
I'm no SBC expert either, but I had a look at sbc_decode()
implementation, and to me it looks like at least "decoded ==
a2dp->frame_length" should hold. Extrapolating from that, "written ==
a2dp->codesize" probably should hold too. And it makes sense:
sbc_decode() is supposed to decode one frame, and I think one frame will
always have encoded size of a2dp->frame_length and decoded size of
a2dp->codesize.
--
Tanu
More information about the pulseaudio-discuss
mailing list