From 6144f8653f77221353211c913306c7e9f863cff8 Mon Sep 17 00:00:00 2001 From: Tom Yan Date: Mon, 23 Jul 2018 21:46:09 +0800 Subject: [PATCH] libpulseaudio: fix distortions occur with multiple sink inputs --- packages/libpulseaudio/module-sles-sink.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/libpulseaudio/module-sles-sink.c b/packages/libpulseaudio/module-sles-sink.c index 70c11307a..b4295b389 100644 --- a/packages/libpulseaudio/module-sles-sink.c +++ b/packages/libpulseaudio/module-sles-sink.c @@ -119,6 +119,11 @@ static void process_render(BufferQueueItf bq, void *context) { pa_thread_mq_install(&u->thread_mq); } + if (u->memchunk.memblock) { + pa_memblock_unref(u->memchunk.memblock); + //pa_log_debug("Unrefed\n"); + } + if (PA_UNLIKELY(u->sink->thread_info.rewind_requested)) { //pa_log_debug("Rewinded\n"); pa_sink_process_rewind(u->sink, 0); @@ -129,7 +134,6 @@ static void process_render(BufferQueueItf bq, void *context) { (*bq)->Enqueue(bq, p, u->memchunk.length); //pa_log_debug("Written: %zu\n", u->memchunk.length); pa_memblock_release(u->memchunk.memblock); - pa_memblock_unref(u->memchunk.memblock); } #define CHK(stmt) { \