>From d98ec65d36fad5e523703350485d323926e82bb6 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 4 Mar 2011 14:42:17 +0100 Subject: [PATCH 1/2] bluetooth: Allow frame length changes in a2dp --- src/modules/bluetooth/module-bluetooth-device.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index dc09ffc..6a33ef0 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1386,7 +1386,7 @@ static int a2dp_process_push(struct userdata *u) { pa_assert(u->source); pa_assert(u->read_smoother); - memchunk.memblock = pa_memblock_new(u->core->mempool, u->block_size); + memchunk.memblock = pa_memblock_new(u->core->mempool, 2 * u->block_size); memchunk.index = memchunk.length = 0; for (;;) { @@ -1441,7 +1441,8 @@ static int a2dp_process_push(struct userdata *u) { to_decode = l - sizeof(*header) - sizeof(*payload); d = pa_memblock_acquire(memchunk.memblock); - to_write = memchunk.length = pa_memblock_get_length(memchunk.memblock); + to_write = pa_memblock_get_length(memchunk.memblock); + memchunk.length = 0; while (PA_LIKELY(to_decode > 0 && to_write > 0)) { size_t written; @@ -1463,7 +1464,7 @@ static int a2dp_process_push(struct userdata *u) { /* pa_log_debug("SBC: frame_length: %lu; codesize: %lu", (unsigned long) a2dp->frame_length, (unsigned long) a2dp->codesize); */ pa_assert_fp((size_t) decoded <= to_decode); - pa_assert_fp((size_t) decoded == a2dp->frame_length); + pa_assert_fp((size_t) decoded == sbc_get_frame_length(&a2dp->sbc)); pa_assert_fp((size_t) written <= to_write); pa_assert_fp((size_t) written == a2dp->codesize); @@ -1473,6 +1474,7 @@ static int a2dp_process_push(struct userdata *u) { d = (uint8_t*) d + written; to_write -= written; + memchunk.length += written; frame_count++; } -- 1.7.2.3