summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2023-02-19 17:50:17 -0500
committerScott Murray <scott.murray@konsulko.com>2023-02-19 17:50:17 -0500
commiteaed764bc0a02029287d2531bedf13ce123641ee (patch)
tree6be82a7ee70014976ffdc073edb93fbeb6110d42 /recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch
parent1b347d8823db32ee0b58bacd8c8d54553aca1f2f (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>
Diffstat (limited to 'recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch')
-rw-r--r--recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch b/recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch
new file mode 100644
index 000000000..c63d86155
--- /dev/null
+++ b/recipes-multimedia/musicpd/files/0003-output-PipeWire-call-pw_stream_flush-in-Cancel.patch
@@ -0,0 +1,35 @@
+From 547a084c7ed95c09136159623240b7c92f6a2f5e Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann@gmail.com>
+Date: Fri, 8 Jul 2022 23:38:45 +0200
+Subject: [PATCH] output/PipeWire: call pw_stream_flush() in Cancel()
+
+Clear not only MPD's ring buffer, but also libpipewire's buffers, to
+avoid playing some audio from the previous song after a manual song
+change.
+
+Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1354
+
+Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/547a084c7ed95c09136159623240b7c92f6a2f5e]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
+index 7184edfa5..0f8550d41 100644
+--- a/src/output/plugins/PipeWireOutputPlugin.cxx
++++ b/src/output/plugins/PipeWireOutputPlugin.cxx
+@@ -895,7 +895,12 @@ PipeWireOutput::Cancel() noexcept
+ if (drained)
+ return;
+
++ /* clear MPD's ring buffer */
+ ring_buffer->reset();
++
++ /* clear libpipewire's buffer */
++ pw_stream_flush(stream, false);
++ drained = true;
+ }
+
+ bool
+--
+2.39.0
+