diff options
author | Max Kellermann <max@musicpd.org> | 2021-08-10 10:50:33 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-08-10 10:50:42 +0200 |
commit | 7c9f4f7e4f65aa8460ab5e585c67933149c3b01c (patch) | |
tree | a6028702ac8c94608c122a4ee516d4552e1c1af1 | |
parent | 00fd692ebaf4dc2685aba8d97ea74159bc314bd1 (diff) |
output/pipewire: create inactive stream, fill ring_buffer first
This avoids underruns at the start of playback.
-rw-r--r-- | src/output/plugins/PipeWireOutputPlugin.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx index 82ea5cbbb..37a81d2ad 100644 --- a/src/output/plugins/PipeWireOutputPlugin.cxx +++ b/src/output/plugins/PipeWireOutputPlugin.cxx @@ -336,7 +336,13 @@ PipeWireOutput::Open(AudioFormat &audio_format) { disconnected = false; restore_volume = true; - paused = false; + + /* we're paused (inactive) now because of the flag + PW_STREAM_FLAG_INACTIVE; this way, we can fill the + ring_buffer before activating the stream, to avoid + underruns */ + paused = true; + drain_requested = false; drained = true; @@ -380,6 +386,7 @@ PipeWireOutput::Open(AudioFormat &audio_format) PW_DIRECTION_OUTPUT, target_id, (enum pw_stream_flags)(PW_STREAM_FLAG_AUTOCONNECT | + PW_STREAM_FLAG_INACTIVE | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS), params, 1); |