From 95564ef5cdd517bd22756d3d93977dc019b12957 Mon Sep 17 00:00:00 2001 From: casey langen Date: Mon, 15 Mar 2021 22:32:01 -0700 Subject: [PATCH] Fix pause/resume in PipeWireOut --- src/plugins/pipewireout/PipeWireOut.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/plugins/pipewireout/PipeWireOut.cpp b/src/plugins/pipewireout/PipeWireOut.cpp index 71dcc2d3d..685ca9757 100644 --- a/src/plugins/pipewireout/PipeWireOut.cpp +++ b/src/plugins/pipewireout/PipeWireOut.cpp @@ -151,14 +151,31 @@ void PipeWireOut::Pause() { std::unique_lock lock(this->mutex); this->bufferCondition.notify_all(); } + + { + if (this->pwThreadLoop && this->pwStream) { + pw_thread_loop_lock(this->pwThreadLoop); + pw_stream_set_active(this->pwStream, false); + pw_thread_loop_unlock(this->pwThreadLoop); + } + } } void PipeWireOut::Resume() { this->state = State::Playing; + { std::unique_lock lock(this->mutex); this->bufferCondition.notify_all(); } + + { + if (this->pwThreadLoop && this->pwStream) { + pw_thread_loop_lock(this->pwThreadLoop); + pw_stream_set_active(this->pwStream, true); + pw_thread_loop_unlock(this->pwThreadLoop); + } + } } void PipeWireOut::SetVolume(double volume) {