429e465083ff691e363b1fbe8f569eb50f282695
[AGL/meta-agl-demo.git] / recipes-multimedia / musicpd / files / 0001-output-PipeWire-activate-stream-in-Drain.patch
1 From 6b430ba271f6d45b3f58c256cb8fede3b04f3b7a Mon Sep 17 00:00:00 2001
2 From: Max Kellermann <max.kellermann@gmail.com>
3 Date: Sat, 9 Jul 2022 00:21:27 +0200
4 Subject: [PATCH] output/PipeWire: activate stream in Drain()
5
6 Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/6b430ba271f6d45b3f58c256cb8fede3b04f3b7a]
7 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
8
9 ---
10 diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
11 index 524ab3d87..ccdf5c0e4 100644
12 --- a/src/output/plugins/PipeWireOutputPlugin.cxx
13 +++ b/src/output/plugins/PipeWireOutputPlugin.cxx
14 @@ -866,6 +866,17 @@ PipeWireOutput::Drain()
15  {
16         const PipeWire::ThreadLoopLock lock(thread_loop);
17  
18 +       if (drained)
19 +               return;
20 +
21 +       if (!active) {
22 +               /* there is data in the ring_buffer, but the stream is
23 +                  not yet active; activate it now to ensure it is
24 +                  played before this method returns */
25 +               active = true;
26 +               pw_stream_set_active(stream, true);
27 +       }
28 +
29         drain_requested = true;
30         AtScopeExit(this) { drain_requested = false; };
31  
32 -- 
33 2.39.0
34