From c2e539b780c8cc7518cc5b933e322f7f0f8e369b Mon Sep 17 00:00:00 2001 From: Martin Geier Date: Thu, 17 Apr 2025 11:58:28 +0200 Subject: [PATCH] module-combine-stream: flush data in paused state When stream is paused, internal delay buffers were cleared, but some data could stay in stream output queue. Without a flush, these data where played in front of a new data. Patch was inspired by 64d6ff4184339fe4222b11ceaf9777a88523a7eb fixing the same issue in a filter-chain module. Signed-off-by: Martin Geier --- src/modules/module-combine-stream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/module-combine-stream.c b/src/modules/module-combine-stream.c index 137aafc2b..de63c4a6f 100644 --- a/src/modules/module-combine-stream.c +++ b/src/modules/module-combine-stream.c @@ -1073,6 +1073,7 @@ static void combine_state_changed(void *d, enum pw_stream_state old, enum pw_stream_state state, const char *error) { struct impl *impl = d; + struct stream *s; switch (state) { case PW_STREAM_STATE_ERROR: case PW_STREAM_STATE_UNCONNECTED: @@ -1080,6 +1081,10 @@ static void combine_state_changed(void *d, enum pw_stream_state old, break; case PW_STREAM_STATE_PAUSED: clear_delaybuf(impl); + spa_list_for_each(s, &impl->streams, link) { + pw_stream_flush(s->stream, false); + } + pw_stream_flush(impl->combine, false); impl->combine_id = pw_stream_get_node_id(impl->combine); pw_log_info("got combine id %d", impl->combine_id); break;