From 4874f8a607b62b496aa0a1f6c1f0c3e8570195ae Mon Sep 17 00:00:00 2001 From: "Igor V. Kovalenko" Date: Wed, 30 Dec 2020 00:00:50 +0300 Subject: [PATCH] bluetooth: align max renderable block size to frame size When bluez5 device I/O thread detects it is too slow sending data, allow it to skip up to max rendered block size bytes which must be aligned to frame size. Part-of: --- src/modules/bluetooth/module-bluez5-device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 87a8809ff..9440084a6 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -1484,7 +1484,7 @@ static void thread_func(void *userdata) { if (bytes_to_send > 2 * u->write_block_size) { uint64_t skip_bytes; pa_memchunk tmp; - size_t mempool_max_block_size = pa_mempool_block_size_max(u->core->mempool); + size_t max_render_size = pa_frame_align(pa_mempool_block_size_max(u->core->mempool), &u->encoder_sample_spec); pa_usec_t skip_usec; skip_bytes = bytes_to_send - 2 * u->write_block_size; @@ -1497,8 +1497,8 @@ static void thread_func(void *userdata) { while (skip_bytes > 0) { size_t bytes_to_render; - if (skip_bytes > mempool_max_block_size) - bytes_to_render = mempool_max_block_size; + if (skip_bytes > max_render_size) + bytes_to_render = max_render_size; else bytes_to_render = skip_bytes; -- GitLab