From 72b9577d3cc8fbf373fb9373b3aae87afb092e0c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 28 Apr 2026 14:55:13 +0200 Subject: [PATCH] filter: avoid losing buffers in some cases If the filter process doesn't dequeue/queue a buffer (as can be the case in jack-tunnel-sink under xrun cases), pw-filter will set the io to NEED_DATA with ID_INVALID. This will then make the mixer in the next cycle not recycle any buffers and it won't be able to produce any new ones either. If the filter the dequeues/queues a buffer in the next process, it won't dequeue a buffer for recycle because io is NEED_DATA/INVALID from the previous cycle (io != HAVE_DATA -> continue). This will the continue in an infinite loop producing "out of buffers" forever. Also check that we actually have a buffer to recycle, if we don't we can try to dequeue one and place that in the io. This will then unlock the loop, make the mixer recycle the buffer and produce a new one. This is the same logic as is present in pw-stream for the same reason. Fixes #5246 Maybe also #3547 --- src/pipewire/filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index e88a5db0a..872458284 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -1055,7 +1055,8 @@ static int impl_node_process(void *object) if (p->direction == SPA_DIRECTION_INPUT) { res |= SPA_STATUS_NEED_DATA; - if (SPA_UNLIKELY(io->status != SPA_STATUS_HAVE_DATA)) + if (SPA_UNLIKELY(io->status != SPA_STATUS_HAVE_DATA && + io->buffer_id != SPA_ID_INVALID)) continue; /* pop buffer to recycle */