From: Wim Taymans Date: Wed, 10 Jan 2007 16:08:18 +0000 (+0000) Subject: gst/playback/: Fix the case where we try to ref a NULL element when we delay a link... X-Git-Tag: RELEASE-0_10_12~128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f147830e1e6e057a4bb3a0fc53771b56f507074;p=platform%2Fupstream%2Fgst-plugins-base.git gst/playback/: Fix the case where we try to ref a NULL element when we delay a link because of unfixed caps. Original commit message from CVS: * gst/playback/gstdecodebin.c: (dynamic_add), (close_pad_link), (is_demuxer_element), (new_caps): * gst/playback/gstplaybasebin.c: (source_new_pad): Fix the case where we try to ref a NULL element when we delay a link because of unfixed caps. Set the state of autoplugged decodebins to PAUSED. RTSP now works in playbin, we can remove it from the blacklist. --- diff --git a/ChangeLog b/ChangeLog index e4ed9c5..8768e4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-01-10 Wim Taymans + + * gst/playback/gstdecodebin.c: (dynamic_add), (close_pad_link), + (is_demuxer_element), (new_caps): + * gst/playback/gstplaybasebin.c: (source_new_pad): + Fix the case where we try to ref a NULL element when we delay a link + because of unfixed caps. + Set the state of autoplugged decodebins to PAUSED. + RTSP now works in playbin, we can remove it from the blacklist. + 2007-01-09 Tim-Philipp Müller * gst/playback/Makefile.am: diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 314468e..47d2844 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -409,7 +409,7 @@ dynamic_add (GstElement * element, GstPad * pad, GstDecodeBin * decode_bin) struct DynFind find_info; GList *found; - g_return_if_fail (element != NULL || pad != NULL); + g_return_if_fail (element != NULL); /* do a search that this entry doesn't already exist */ find_info.elem = element; @@ -421,25 +421,21 @@ dynamic_add (GstElement * element, GstPad * pad, GstDecodeBin * decode_bin) /* take refs */ dyn = g_new0 (GstDynamic, 1); - dyn->element = element; - dyn->pad = pad; + dyn->element = gst_object_ref (element); dyn->decode_bin = gst_object_ref (decode_bin); - if (element) { + if (pad) { + dyn->pad = gst_object_ref (pad); + GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT, + pad); + dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps", + G_CALLBACK (new_caps), dyn); + } else { GST_DEBUG_OBJECT (decode_bin, "dynamic create for element %" GST_PTR_FORMAT, element); - - gst_object_ref (element); dyn->np_sig_id = g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (new_pad), dyn); dyn->nmp_sig_id = g_signal_connect (G_OBJECT (element), "no-more-pads", G_CALLBACK (no_more_pads), dyn); - } else { - GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT, - pad); - - gst_object_ref (pad); - dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps", - G_CALLBACK (new_caps), dyn); } /* and add this element to the dynamic elements */ @@ -794,7 +790,7 @@ many_types: setup_caps_delay: { GST_LOG_OBJECT (pad, "setting up a delayed link"); - dynamic_add (NULL, pad, decode_bin); + dynamic_add (element, pad, decode_bin); return; } } @@ -814,7 +810,7 @@ is_demuxer_element (GstElement * srcelement) klass = gst_element_factory_get_klass (srcfactory); /* Can't be a demuxer unless it has Demux in the klass name */ - if (!strstr (klass, "Demux")) + if (klass == NULL || !strstr (klass, "Demux")) return FALSE; /* Walk the src pad templates and count how many the element @@ -1311,7 +1307,7 @@ no_more_pads (GstElement * element, GstDynamic * dynamic) static void new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic) { - GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered\n"); + GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered"); new_pad (dynamic->element, pad, dynamic); diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 52a34a1..9d37b6c 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -1451,7 +1451,7 @@ static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://", }; /* blacklisted URIs, we know they will always fail. */ -static const gchar *blacklisted_uris[] = { "rtsp://", NULL }; +static const gchar *blacklisted_uris[] = { NULL }; /* mime types that we don't consider to be media types */ static const gchar *no_media_mimes[] = { @@ -1580,6 +1580,8 @@ source_new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin) if (!gst_element_link (bin->source, decoder)) goto could_not_link; + gst_element_set_state (decoder, GST_STATE_PAUSED); + return; /* ERRORS */