From f173fa15b19b735b4aa727015c58a177c0b28803 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 23 Jul 2014 19:51:36 +0200 Subject: [PATCH] decodebin: Don't unref caps for which we don't own a reference... get one first https://bugzilla.gnome.org/show_bug.cgi?id=733615 --- gst/playback/gstdecodebin2.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 7d3229e..4b0779b 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1536,6 +1536,12 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad, group->no_more_pads = TRUE; } + /* From here on we own a reference to the caps as + * we might create new caps below and would need + * to unref them later */ + if (caps) + gst_caps_ref (caps); + if ((caps == NULL) || gst_caps_is_empty (caps)) goto unknown_type; @@ -1765,6 +1771,8 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad, if (!res) goto unknown_type; + gst_caps_unref (caps); + return; expose_pad: @@ -1772,6 +1780,7 @@ expose_pad: GST_LOG_OBJECT (dbin, "Pad is final. autoplug-continue:%d", apcontinue); expose_pad (dbin, src, dpad, pad, caps, chain); gst_object_unref (dpad); + gst_caps_unref (caps); return; } @@ -1779,7 +1788,7 @@ discarded_type: { GST_LOG_OBJECT (pad, "Known type, but discarded because not final caps"); chain->deadend = TRUE; - chain->endcaps = gst_caps_ref (caps); + chain->endcaps = caps; gst_object_replace ((GstObject **) & chain->current_pad, NULL); /* Try to expose anything */ @@ -1798,7 +1807,7 @@ unknown_type: GST_LOG_OBJECT (pad, "Unknown type, posting message and firing signal"); chain->deadend = TRUE; - chain->endcaps = gst_caps_ref (caps); + chain->endcaps = caps; gst_object_replace ((GstObject **) & chain->current_pad, NULL); gst_element_post_message (GST_ELEMENT_CAST (dbin), @@ -1868,6 +1877,8 @@ setup_caps_delay: * we have to unref the pad */ if (is_parser_converter) gst_object_unref (pad); + if (caps) + gst_caps_unref (caps); return; } -- 2.7.4