From a5918b0ab5c2880244ea75fe7ecafbee455a2daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 18 Feb 2014 15:02:57 +0100 Subject: [PATCH] playbin: Keep inputselector around until we release its pads Otherwise there's an interesting race condition when we destroy the inputselector (actually it will be destroyed later when its state change message gets destroyed) and afterwards release its sinkpad. This is the code path when the last channel is removed from the input selector. Gave this warning sometimes, for chained oggs or whenever else we change decode groups: GStreamer-CRITICAL **: Padname '':sink_0 does not belong to element inputselector0 when removing --- gst/playback/gstplaybin2.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 40c0252690..f330e535d5 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -3271,6 +3271,13 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) if (!(peer = g_object_get_data (G_OBJECT (pad), "playbin.sinkpad"))) goto not_linked; + /* unlink the pad now (can fail, the pad is unlinked before it's removed) */ + gst_pad_unlink (pad, peer); + + /* get combiner */ + combiner = GST_ELEMENT_CAST (gst_pad_get_parent (peer)); + g_assert (combiner != NULL); + if ((combine = g_object_get_data (G_OBJECT (peer), "playbin.combine"))) { if (combine->has_tags) { gulong notify_tags_handler; @@ -3315,17 +3322,6 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) } } - /* unlink the pad now (can fail, the pad is unlinked before it's removed) */ - gst_pad_unlink (pad, peer); - - /* get combiner, this can be NULL when the element is removing the pads - * because it's being disposed. */ - combiner = GST_ELEMENT_CAST (gst_pad_get_parent (peer)); - if (!combiner) { - gst_object_unref (peer); - goto no_combiner; - } - /* release the pad to the combiner, this will make the combiner choose a new * pad. */ gst_element_release_request_pad (combiner, peer); @@ -3346,11 +3342,6 @@ not_linked: GST_DEBUG_OBJECT (playbin, "pad not linked"); goto exit; } -no_combiner: - { - GST_DEBUG_OBJECT (playbin, "combiner not found"); - goto exit; - } } /* we get called when all pads are available and we must connect the sinks to