From 384d93feb21726ab34a116a87f7dea4b9ea84a26 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Sun, 19 Feb 2023 17:50:17 -0500 Subject: mpd: Backport PipeWire output fixes Backport four PipeWire output plugin fixes related to handling very short audio files. They fix MPD hanging in the Drain call of the plugin when playing very short files like truncated ones attached to SPEC-4661. These patches can be removed when MPD is upgraded to 0.23.8 or newer. Bug-AGL: SPEC-4661 Change-Id: I42b5dd4c08863c7209a75f6ede777402a11cfc87 Signed-off-by: Scott Murray (cherry picked from commit eaed764bc0a02029287d2531bedf13ce123641ee) --- ...-output-PipeWire-activate-stream-in-Drain.patch | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 recipes-multimedia/musicpd/files/0001-output-PipeWire-activate-stream-in-Drain.patch (limited to 'recipes-multimedia/musicpd/files/0001-output-PipeWire-activate-stream-in-Drain.patch') diff --git a/recipes-multimedia/musicpd/files/0001-output-PipeWire-activate-stream-in-Drain.patch b/recipes-multimedia/musicpd/files/0001-output-PipeWire-activate-stream-in-Drain.patch new file mode 100644 index 00000000..429e4650 --- /dev/null +++ b/recipes-multimedia/musicpd/files/0001-output-PipeWire-activate-stream-in-Drain.patch @@ -0,0 +1,34 @@ +From 6b430ba271f6d45b3f58c256cb8fede3b04f3b7a Mon Sep 17 00:00:00 2001 +From: Max Kellermann +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 + +--- +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 + -- cgit 1.2.3-korg