Skip to content
Snippets Groups Projects
Commit beecec04 authored by Thomas Guillem's avatar Thomas Guillem
Browse files

pipewire: don't drain empty streams

Fixes the following assert when seeking more than one time past the end of
the file.

src/audio_output/dec.c:1107: vlc_aout_stream_Drain: Assertion `!atomic_load_explicit(&stream->drained, memory_order_relaxed)' failed.

Calling `pw_stream_flush(s->stream, true)`, when empty, leads to
undefined behavior and might cause the `stream_drained()` callback to be
called in loop (leading to the mentioned assert after a flush).
parent 3a325614
No related branches found
No related tags found
1 merge request!6771pipewire: don't drain empty streams
Pipeline #563621 passed with stages
in 30 minutes and 54 seconds
......@@ -374,8 +374,9 @@ static void vlc_pw_stream_flush(struct vlc_pw_stream *s)
static void vlc_pw_stream_drain(struct vlc_pw_stream *s)
{
vlc_pw_lock(s->context);
bool empty = s->start == VLC_TICK_INVALID;
s->first_pts = s->start = VLC_TICK_INVALID;
if (vlc_pw_stream_get_state(s) == PW_STREAM_STATE_ERROR)
if (vlc_pw_stream_get_state(s) == PW_STREAM_STATE_ERROR || empty)
stream_drained(s); /* Don't wait on a failed stream */
else if (s->queue.head == NULL)
pw_stream_flush(s->stream, true); /* Drain now */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment