playbin2: do not take a superfluous ref on uridecodebin instances

... which are no longer FLOATING.
This commit is contained in:
Mark Nauwelaerts 2012-03-09 14:16:03 +01:00
parent 5fee17ac8f
commit 8c99412a0d

View file

@ -3541,7 +3541,10 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
GST_DEBUG_OBJECT (playbin, "reusing existing uridecodebin"); GST_DEBUG_OBJECT (playbin, "reusing existing uridecodebin");
uridecodebin = group->uridecodebin; uridecodebin = group->uridecodebin;
gst_element_set_state (uridecodebin, GST_STATE_READY); gst_element_set_state (uridecodebin, GST_STATE_READY);
gst_bin_add (GST_BIN_CAST (playbin), gst_object_ref (uridecodebin)); /* no need to take extra ref, we already have one
* and the bin will add one since it is no longer floating,
* as it was at least added once before (below) */
gst_bin_add (GST_BIN_CAST (playbin), uridecodebin);
} else { } else {
GST_DEBUG_OBJECT (playbin, "making new uridecodebin"); GST_DEBUG_OBJECT (playbin, "making new uridecodebin");
uridecodebin = gst_element_factory_make ("uridecodebin", NULL); uridecodebin = gst_element_factory_make ("uridecodebin", NULL);
@ -3604,7 +3607,10 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
GST_DEBUG_OBJECT (playbin, "reusing existing suburidecodebin"); GST_DEBUG_OBJECT (playbin, "reusing existing suburidecodebin");
suburidecodebin = group->suburidecodebin; suburidecodebin = group->suburidecodebin;
gst_element_set_state (suburidecodebin, GST_STATE_READY); gst_element_set_state (suburidecodebin, GST_STATE_READY);
gst_bin_add (GST_BIN_CAST (playbin), gst_object_ref (suburidecodebin)); /* no need to take extra ref, we already have one
* and the bin will add one since it is no longer floating,
* as it was at least added once before (below) */
gst_bin_add (GST_BIN_CAST (playbin), suburidecodebin);
} else { } else {
GST_DEBUG_OBJECT (playbin, "making new suburidecodebin"); GST_DEBUG_OBJECT (playbin, "making new suburidecodebin");
suburidecodebin = gst_element_factory_make ("uridecodebin", NULL); suburidecodebin = gst_element_factory_make ("uridecodebin", NULL);