playbin3: Hold playbin lock on pad-added
authorJan Schmidt <jan@centricular.com>
Mon, 17 Jan 2022 18:48:08 +0000 (05:48 +1100)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 11 Mar 2022 14:02:02 +0000 (15:02 +0100)
Take the playbin lock when accessing the combiner
to add a new pad to link to. Fixes races against
streams-selected messages triggering reconfiguration.

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

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

index 1192101..55f7165 100644 (file)
@@ -3113,6 +3113,7 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstSourceGroup * group)
     goto unknown_type;
   }
 
+  GST_PLAY_BIN3_LOCK (playbin);
   combine = &playbin->combiner[pb_stream_type];
 
   combiner_control_pad (playbin, combine, pad);
@@ -3127,6 +3128,7 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstSourceGroup * group)
     group->pending_about_to_finish = FALSE;
     emit_about_to_finish (playbin);
   }
+  GST_PLAY_BIN3_UNLOCK (playbin);
 
   GST_PLAY_BIN3_SHUTDOWN_UNLOCK (playbin);