basetransform: Fix a caps leak and move a codeblock

The result from the block of code that was moved would only have
been used if 'peercaps' was present.
This commit is contained in:
Edward Hervey 2011-10-11 13:51:54 +02:00
parent 917bfc5df7
commit ece5909804

View file

@ -684,6 +684,7 @@ gst_base_transform_getcaps (GstPad * pad, GstCaps * filter)
if (caps == NULL) if (caps == NULL)
goto done; goto done;
if (peercaps) {
/* and filter against the template of this pad */ /* and filter against the template of this pad */
templ = gst_pad_get_pad_template_caps (pad); templ = gst_pad_get_pad_template_caps (pad);
GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ); GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ);
@ -694,7 +695,6 @@ gst_base_transform_getcaps (GstPad * pad, GstCaps * filter)
gst_caps_unref (templ); gst_caps_unref (templ);
caps = temp; caps = temp;
if (peercaps) {
/* Now try if we can put the untransformed downstream caps first */ /* Now try if we can put the untransformed downstream caps first */
temp = gst_caps_intersect_full (peercaps, caps, GST_CAPS_INTERSECT_FIRST); temp = gst_caps_intersect_full (peercaps, caps, GST_CAPS_INTERSECT_FIRST);
if (!gst_caps_is_empty (temp)) { if (!gst_caps_is_empty (temp)) {
@ -704,6 +704,7 @@ gst_base_transform_getcaps (GstPad * pad, GstCaps * filter)
gst_caps_unref (temp); gst_caps_unref (temp);
} }
} else { } else {
gst_caps_unref (caps);
/* no peer or the peer can do anything, our padtemplate is enough then */ /* no peer or the peer can do anything, our padtemplate is enough then */
caps = gst_pad_get_pad_template_caps (pad); caps = gst_pad_get_pad_template_caps (pad);