gst/playback/gstdecodebin2.c: Decodebin2 doesn't unref pads it obtains in some occasions:
authorTommi Myöhänen <ext-tommi.myohanen@nokia.com>
Tue, 3 Apr 2007 11:10:52 +0000 (11:10 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 3 Apr 2007 11:10:52 +0000 (11:10 +0000)
Original commit message from CVS:
Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com>
* gst/playback/gstdecodebin2.c: (connect_pad), (expose_pad),
(deactivate_free_recursive):
Decodebin2 doesn't unref pads it obtains in some occasions:
- multiqueue src pads, when either connecting further or exposing
- sink pads of new autoplugged elements
- peer pads when recursively freeing elements
Fixes #425455.

ChangeLog
gst/playback/gstdecodebin2.c

index 0bbc4e6e13d00164dcea2366e19603624082aea5..e18358b6d33509896ebe36da55f138d0850a96a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-04-03  Wim Taymans  <wim@fluendo.com>
+
+       Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com>
+
+       * gst/playback/gstdecodebin2.c: (connect_pad), (expose_pad),
+       (deactivate_free_recursive):
+       Decodebin2 doesn't unref pads it obtains in some occasions:
+       - multiqueue src pads, when either connecting further or exposing
+       - sink pads of new autoplugged elements
+       - peer pads when recursively freeing elements
+       Fixes #425455.
+
 2007-03-30  Sebastian Dröge  <slomo@circular-chaos.org>
 
        * gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
index c3a5068f9a51876864a88ad59d45f0f19be92fcf..5d9420a99bd7ffd6018029a38febce485bff4aeb 100644 (file)
@@ -835,6 +835,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
 {
   gboolean res = FALSE;
   GList *tmp;
+  GstPad *mqpad = NULL;
 
   g_return_val_if_fail (factories != NULL, FALSE);
   GST_DEBUG_OBJECT (dbin, "pad %s:%s , group:%p",
@@ -842,8 +843,6 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
 
   /* 1. is element demuxer or parser */
   if (is_demuxer_element (src)) {
-    GstPad *mqpad;
-
     GST_LOG_OBJECT (src, "is a demuxer, connecting the pad through multiqueue");
 
     if (!group)
@@ -908,7 +907,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
       gst_bin_remove (GST_BIN (dbin), element);
       continue;
     }
-
+    gst_object_unref (sinkpad);
     GST_LOG_OBJECT (dbin, "linked on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
 
     /* link this element further */
@@ -920,7 +919,6 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
       GST_WARNING_OBJECT (dbin, "Couldn't set %s to PAUSED",
           GST_ELEMENT_NAME (element));
       gst_element_set_state (element, GST_STATE_NULL);
-      gst_object_unref (sinkpad);
       gst_bin_remove (GST_BIN (dbin), element);
       continue;
     }
@@ -929,6 +927,9 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
     break;
   }
 
+  if (mqpad)
+    gst_object_unref (mqpad);
+
 beach:
   return res;
 }
@@ -1058,6 +1059,7 @@ expose_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
 {
   gboolean newgroup = FALSE;
   gboolean isdemux;
+  GstPad *mqpad = NULL;
 
   GST_DEBUG_OBJECT (dbin, "pad %s:%s, group:%p",
       GST_DEBUG_PAD_NAME (pad), group);
@@ -1074,8 +1076,6 @@ expose_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
   isdemux = is_demuxer_element (src);
 
   if (isdemux || newgroup) {
-    GstPad *mqpad;
-
     GST_LOG_OBJECT (src, "is a demuxer, connecting the pad through multiqueue");
 
     if (!(mqpad = gst_decode_group_control_demuxer_pad (group, pad)))
@@ -1091,6 +1091,9 @@ expose_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
      * group as being complete. */
     gst_decode_group_set_complete (group);
   }
+  if (mqpad)
+    gst_object_unref (mqpad);
+
 beach:
   return;
 }
@@ -1823,7 +1826,10 @@ restart:
         GstPad *peerpad = NULL;
 
         if ((peerpad = gst_pad_get_peer (pad))) {
-          GstObject *parent = gst_pad_get_parent (peerpad);
+          GstObject *parent;
+
+          parent = gst_pad_get_parent (peerpad);
+          gst_object_unref (peerpad);
 
           if (parent && GST_IS_ELEMENT (parent))
             deactivate_free_recursive (group, GST_ELEMENT (parent));