From 547a084c7ed95c09136159623240b7c92f6a2f5e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 8 Jul 2022 23:38:45 +0200 Subject: [PATCH] output/PipeWire: call pw_stream_flush() in Cancel() Clear not only MPD's ring buffer, but also libpipewire's buffers, to avoid playing some audio from the previous song after a manual song change. Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1354 --- NEWS | 1 + src/output/plugins/PipeWireOutputPlugin.cxx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 48ae6f8af..8056bb7ba 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ ver 0.23.8 (not yet released) - cdio_paranoia: faster cancellation - cdio_paranoia: don't scan for replay gain tags - pipewire: fix playback of very short tracks + - pipewire: drop all buffers before manual song change - snapcast: fix busy loop while paused - snapcast: fix stuttering after resuming playback * mixer diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx index 7184edfa5..0f8550d41 100644 --- a/src/output/plugins/PipeWireOutputPlugin.cxx +++ b/src/output/plugins/PipeWireOutputPlugin.cxx @@ -895,7 +895,12 @@ PipeWireOutput::Cancel() noexcept if (drained) return; + /* clear MPD's ring buffer */ ring_buffer->reset(); + + /* clear libpipewire's buffer */ + pw_stream_flush(stream, false); + drained = true; } bool