[vlc-commits] [Git][videolan/vlc][master] pipewire: don't drain empty streams

Thomas Guillem (@tguillem) gitlab at videolan.org
Thu Feb 6 07:54:16 UTC 2025



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
beecec04 by Thomas Guillem at 2025-02-06T06:10:42+00:00
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).

- - - - -


1 changed file:

- modules/audio_output/pipewire.c


Changes:

=====================================
modules/audio_output/pipewire.c
=====================================
@@ -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 */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/beecec04ced528de9f4e37e80e221f991c7a483f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/beecec04ced528de9f4e37e80e221f991c7a483f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list