mpd: Backport PipeWire output fixes
[AGL/meta-agl-demo.git] / recipes-multimedia / musicpd / files / 0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch
1 From 547a084c7ed95c09136159623240b7c92f6a2f5e Mon Sep 17 00:00:00 2001
2 From: Max Kellermann <max.kellermann@gmail.com>
3 Date: Fri, 8 Jul 2022 23:38:45 +0200
4 Subject: [PATCH] output/PipeWire: call pw_stream_flush() in Cancel()
5
6 Clear not only MPD's ring buffer, but also libpipewire's buffers, to
7 avoid playing some audio from the previous song after a manual song
8 change.
9
10 Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1354
11
12 Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/547a084c7ed95c09136159623240b7c92f6a2f5e]
13 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
14
15 ---
16 diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
17 index 7184edfa5..0f8550d41 100644
18 --- a/src/output/plugins/PipeWireOutputPlugin.cxx
19 +++ b/src/output/plugins/PipeWireOutputPlugin.cxx
20 @@ -895,7 +895,12 @@ PipeWireOutput::Cancel() noexcept
21         if (drained)
22                 return;
23  
24 +       /* clear MPD's ring buffer */
25         ring_buffer->reset();
26 +
27 +       /* clear libpipewire's buffer */
28 +       pw_stream_flush(stream, false);
29 +       drained = true;
30  }
31  
32  bool
33 -- 
34 2.39.0
35