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
This commit is contained in:
Sebastian Dröge 2014-02-18 15:02:57 +01:00
parent 6c6619a669
commit a5918b0ab5

View file

@ -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