output/pipewire: create inactive stream, fill ring_buffer first

This avoids underruns at the start of playback.
This commit is contained in:
Max Kellermann 2021-08-10 10:50:33 +02:00
parent 00fd692eba
commit 7c9f4f7e4f

View File

@ -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);