From 9e2ce5bbb56e3ca37652de249ccba64794db900e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 7 Sep 2011 16:43:36 +0200 Subject: [PATCH] decodebin2: Make sure to fixate Parser/Converter caps before continuing autoplugging --- gst/playback/gstdecodebin2.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 5c397936a8..cde20c2a42 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1378,13 +1378,14 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad, GstDecodePad *dpad; GstElementFactory *factory; const gchar *classification; - gboolean is_parser_converter; + gboolean is_parser_converter = FALSE; GST_DEBUG_OBJECT (dbin, "Pad %s:%s caps:%" GST_PTR_FORMAT, GST_DEBUG_PAD_NAME (pad), caps); if (chain->elements - && src != ((GstDecodeElement *) chain->elements->data)->element) { + && src != ((GstDecodeElement *) chain->elements->data)->element + && src != ((GstDecodeElement *) chain->elements->data)->capsfilter) { GST_ERROR_OBJECT (dbin, "New pad from not the last element in this chain"); return; } @@ -1595,6 +1596,11 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad, p = gst_element_get_static_pad (delem->capsfilter, "src"); gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), p); pad = p; + + if (!gst_caps_is_fixed (caps)) { + g_value_array_free (factories); + goto non_fixed; + } } /* 1.h else continue autoplugging something from the list. */ @@ -1705,6 +1711,12 @@ setup_caps_delay: g_signal_connect (G_OBJECT (pad), "notify::caps", G_CALLBACK (caps_notify_cb), chain); CHAIN_MUTEX_UNLOCK (chain); + + /* If we're here because we have a Parser/Converter + * we have to unref the pad */ + if (is_parser_converter) + gst_object_unref (pad); + return; } }