summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2013-01-16 14:42:38 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.com>2013-01-16 14:51:07 -0500
commitc9fbf274f43e8e5265dda388f888815da51dd51a (patch)
tree26d3ce545b86d8fde99b1abab6996fc762da9203 /sys
parent410d0c0194d2628f271da0a1c810ad77446cf733 (diff)
downloadgstreamer-plugins-bad-c9fbf274f43e8e5265dda388f888815da51dd51a.tar.gz
uvch264: do not double-unref if transform_caps fails
Diffstat (limited to 'sys')
-rw-r--r--sys/uvch264/gstuvch264_src.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/uvch264/gstuvch264_src.c b/sys/uvch264/gstuvch264_src.c
index 206ead8bb..6901131fc 100644
--- a/sys/uvch264/gstuvch264_src.c
+++ b/sys/uvch264/gstuvch264_src.c
@@ -2187,6 +2187,7 @@ _transform_caps (GstUvcH264Src * self, GstCaps * caps, const gchar * name)
GstElement *cf = gst_element_factory_make ("capsfilter", NULL);
GstElement *fs = gst_element_factory_make ("fakesink", NULL);
GstPad *sink;
+ GstCaps *out_caps = NULL;
if (!el || !cf || !fs || !gst_bin_add (GST_BIN (self), el)) {
if (el)
@@ -2210,6 +2211,8 @@ _transform_caps (GstUvcH264Src * self, GstCaps * caps, const gchar * name)
goto done;
}
+ g_object_set (cf, "caps", caps, NULL);
+
if (!gst_element_link (cf, fs))
goto error_remove;
if (!gst_element_link (el, cf))
@@ -2218,18 +2221,23 @@ _transform_caps (GstUvcH264Src * self, GstCaps * caps, const gchar * name)
sink = gst_element_get_static_pad (el, "sink");
if (!sink)
goto error_remove;
- g_object_set (cf, "caps", caps, NULL);
+ GST_DEBUG_OBJECT (self, "Transforming: %" GST_PTR_FORMAT, caps);
- caps = gst_pad_get_caps (sink);
+ out_caps = gst_pad_get_caps (sink);
gst_object_unref (sink);
+ GST_DEBUG_OBJECT (self, "Result: %" GST_PTR_FORMAT, out_caps);
+
error_remove:
gst_bin_remove (GST_BIN (self), cf);
gst_bin_remove (GST_BIN (self), el);
gst_bin_remove (GST_BIN (self), fs);
done:
- return caps;
+ if (out_caps == NULL)
+ out_caps = gst_caps_copy (caps);
+
+ return out_caps;
}
static GstCaps *