uridecodebin3: fix deadlock when switching input item
authorGuillaume Desmottes <guillaume.desmottes@onestream.live>
Mon, 19 Feb 2024 14:55:55 +0000 (15:55 +0100)
committerGuillaume Desmottes <guillaume.desmottes@onestream.live>
Mon, 19 Feb 2024 15:22:12 +0000 (16:22 +0100)
There was a race between urisourcebin src pad handlers.
One was starting the next item before the other was blocked.

See
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3297#note_2288799
for details.

Fix #3297

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6145>

subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c

index f8522a05130cd5582c5dd4d3fd89074de1516127..9bcd791042ee8cc4401df2249876008efad5cf2b 100644 (file)
@@ -1356,7 +1356,10 @@ uri_src_block_probe (GstPad * pad, GstPadProbeInfo * info,
   }
 
   PLAY_ITEMS_LOCK (handler->uridecodebin);
-  if (play_item_is_eos (handler->uridecodebin->input_item)) {
+  if (srcpad->block_probe_id == 0) {
+    GST_DEBUG_OBJECT (pad, "pad has already been unblocked");
+    ret = GST_PAD_PROBE_REMOVE;
+  } else if (play_item_is_eos (handler->uridecodebin->input_item)) {
     GST_DEBUG_OBJECT (handler->uridecodebin,
         "We can switch over to the next input item");
     switch_and_activate_input_locked (handler->uridecodebin,