diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-02-24 09:45:52 +0100 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-06-05 12:11:47 +0200 |
commit | 84c7bb414de1ce3439f0d39df049f9b4f2d6b0c2 (patch) | |
tree | e564bfa5714de2d6df170a20fb4c7524c088fa99 | |
parent | ca1c9ca790cadd7fe6a23150d84d2160b1972c87 (diff) |
bluetooth: skip audio in smaller chunks
Render audio in smaller chunks, the amount of data to mix is not bounded
and we might end up hitting the maximum memory limit (96M).
Fixes rhbz#989552
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-device.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 6c0c74627..d06f66920 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1116,15 +1116,19 @@ static void thread_func(void *userdata) { skip_bytes = pa_usec_to_bytes(skip_usec, &u->sample_spec); if (skip_bytes > 0) { - pa_memchunk tmp; - pa_log_warn("Skipping %llu us (= %llu bytes) in audio stream", (unsigned long long) skip_usec, (unsigned long long) skip_bytes); + do { + pa_memchunk tmp; + uint64_t to_skip = MIN (skip_bytes, 65535); + + pa_sink_render_full(u->sink, to_skip, &tmp); + pa_memblock_unref(tmp.memblock); - pa_sink_render_full(u->sink, skip_bytes, &tmp); - pa_memblock_unref(tmp.memblock); - u->write_index += skip_bytes; + u->write_index += to_skip; + skip_bytes -= to_skip; + } while (skip_bytes > 0); if (u->profile == PROFILE_A2DP) a2dp_reduce_bitpool(u); |