diff options
author | Max Kellermann <max@musicpd.org> | 2021-08-10 10:21:37 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-08-10 10:48:25 +0200 |
commit | 00fd692ebaf4dc2685aba8d97ea74159bc314bd1 (patch) | |
tree | 30f1a85744e27c811a07059aad16cfb3f98d576f | |
parent | 668c3782b22c712ecc7eff30c056eb89eac64479 (diff) |
output/pipewire: wait for buffer to fill before resuming
-rw-r--r-- | src/output/plugins/PipeWireOutputPlugin.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx index fbc8208b9..82ea5cbbb 100644 --- a/src/output/plugins/PipeWireOutputPlugin.cxx +++ b/src/output/plugins/PipeWireOutputPlugin.cxx @@ -462,11 +462,6 @@ PipeWireOutput::Play(const void *chunk, size_t size) { const PipeWire::ThreadLoopLock lock(thread_loop); - if (paused) { - paused = false; - pw_stream_set_active(stream, true); - } - while (true) { CheckThrowError(); @@ -477,6 +472,14 @@ PipeWireOutput::Play(const void *chunk, size_t size) return bytes_written; } + if (paused) { + /* now that the ring_buffer is full, there is + enough data for Process(), so let's resume + the stream now */ + paused = false; + pw_stream_set_active(stream, true); + } + if (interrupted) throw AudioOutputInterrupted{}; |