From d7e48f3042e677198ac3b5ef03677da54c59561a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 1 Feb 2024 15:57:45 +0100 Subject: [PATCH] module-pipe: resync when ringbuffer too full When the ringbuffer has too much data, do a resync or else we would just have a huge delay and would try to resample to get back to the target fill level. --- src/modules/module-pipe-tunnel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/module-pipe-tunnel.c b/src/modules/module-pipe-tunnel.c index 4935d07f6..8f44eb3b4 100644 --- a/src/modules/module-pipe-tunnel.c +++ b/src/modules/module-pipe-tunnel.c @@ -416,6 +416,10 @@ static void capture_stream_process(void *data) } impl->have_sync = false; } + if (avail > (int32_t)(impl->target_buffer * 3)) { + pw_log_warn("resync %d > %u", avail, (int32_t)(impl->target_buffer * 3)); + impl->have_sync = false; + } if (avail > (int32_t)RINGBUFFER_SIZE) { index += avail - impl->target_buffer; avail = impl->target_buffer;