1 From c8dae95eff60419fdff88d55400b6cbaacac137d Mon Sep 17 00:00:00 2001
2 From: Max Kellermann <max.kellermann@gmail.com>
3 Date: Sat, 9 Jul 2022 00:59:35 +0200
4 Subject: [PATCH] output/PipeWire: after Cancel(), refill buffer before
7 Deactivate the stream in Cancel(). This fixes stuttering after a
8 manual song change by refilling the whole ring buffer before
9 reactivating the stream.
11 Closes https://github.com/MusicPlayerDaemon/MPD/issues/1354
13 Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/c8dae95eff60419fdff88d55400b6cbaacac137d]
14 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
17 diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
18 index 0f8550d41..16febe909 100644
19 --- a/src/output/plugins/PipeWireOutputPlugin.cxx
20 +++ b/src/output/plugins/PipeWireOutputPlugin.cxx
21 @@ -901,6 +901,15 @@ PipeWireOutput::Cancel() noexcept
22 /* clear libpipewire's buffer */
23 pw_stream_flush(stream, false);
26 + /* pause the PipeWire stream so libpipewire ceases invoking
27 + the "process" callback (we have no data until our Play()
28 + method gets called again); the stream will be resume by
29 + Play() after the ring_buffer has been refilled */
32 + pw_stream_set_active(stream, false);