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() --- NEWS | 1 + src/output/plugins/PipeWireOutputPlugin.cxx | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 80737dc1c..48ae6f8af 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ ver 0.23.8 (not yet released) - cdio_paranoia: fix crash if no drive was found - cdio_paranoia: faster cancellation - cdio_paranoia: don't scan for replay gain tags + - pipewire: fix playback of very short tracks - snapcast: fix busy loop while paused - snapcast: fix stuttering after resuming playback * mixer 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; };