aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/musicpd/files/0001-output-PipeWire-activate-stream-in-Drain.patch
blob: 429e465083ff691e363b1fbe8f569eb50f282695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 6b430ba271f6d45b3f58c256cb8fede3b04f3b7a Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Sat, 9 Jul 2022 00:21:27 +0200
Subject: [PATCH] output/PipeWire: activate stream in Drain()

Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/6b430ba271f6d45b3f58c256cb8fede3b04f3b7a]
Signed-off-by: Scott Murray <scott.murray@konsulko.com>

---
diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
index 524ab3d87..ccdf5c0e4 100644
--- a/src/output/plugins/PipeWireOutputPlugin.cxx
+++ b/src/output/plugins/PipeWireOutputPlugin.cxx
@@ -866,6 +866,17 @@ PipeWireOutput::Drain()
 {
 	const PipeWire::ThreadLoopLock lock(thread_loop);
 
+	if (drained)
+		return;
+
+	if (!active) {
+		/* there is data in the ring_buffer, but the stream is
+		   not yet active; activate it now to ensure it is
+		   played before this method returns */
+		active = true;
+		pw_stream_set_active(stream, true);
+	}
+
 	drain_requested = true;
 	AtScopeExit(this) { drain_requested = false; };
 
-- 
2.39.0