summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2023-02-19 17:50:17 -0500
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2023-02-27 11:12:15 +0000
commit457caeb1e1dba7fda81e62f0692c50c3bea42626 (patch)
treec7894c2c6ce48c76ec6d78e656243860a615d6d1 /recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch
parenta67f478598b103a6a016345b8dccdde32c25cbf4 (diff)
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 <scott.murray@konsulko.com> (cherry picked from commit eaed764bc0a02029287d2531bedf13ce123641ee)
Diffstat (limited to 'recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch')
-rw-r--r--recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch b/recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch
new file mode 100644
index 00000000..6f7d3942
--- /dev/null
+++ b/recipes-multimedia/musicpd/files/0004-output-PipeWire-after-Cancel-refill-buffer-before-re.patch
@@ -0,0 +1,39 @@
+From c8dae95eff60419fdff88d55400b6cbaacac137d Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann@gmail.com>
+Date: Sat, 9 Jul 2022 00:59:35 +0200
+Subject: [PATCH] output/PipeWire: after Cancel(), refill buffer before
+ resuming playback
+
+Deactivate the stream in Cancel(). This fixes stuttering after a
+manual song change by refilling the whole ring buffer before
+reactivating the stream.
+
+Closes https://github.com/MusicPlayerDaemon/MPD/issues/1354
+
+Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/c8dae95eff60419fdff88d55400b6cbaacac137d]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
+index 0f8550d41..16febe909 100644
+--- a/src/output/plugins/PipeWireOutputPlugin.cxx
++++ b/src/output/plugins/PipeWireOutputPlugin.cxx
+@@ -901,6 +901,15 @@ PipeWireOutput::Cancel() noexcept
+ /* clear libpipewire's buffer */
+ pw_stream_flush(stream, false);
+ drained = true;
++
++ /* pause the PipeWire stream so libpipewire ceases invoking
++ the "process" callback (we have no data until our Play()
++ method gets called again); the stream will be resume by
++ Play() after the ring_buffer has been refilled */
++ if (active) {
++ active = false;
++ pw_stream_set_active(stream, false);
++ }
+ }
+
+ bool
+--
+2.39.0
+