appsrc: handle NULL caps correctly
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 19 Jan 2012 14:18:58 +0000 (15:18 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 19 Jan 2012 14:18:58 +0000 (15:18 +0100)
gst-libs/gst/app/gstappsrc.c

index b355ea2..0b8012b 100644 (file)
@@ -1120,12 +1120,15 @@ gst_app_src_get_caps (GstAppSrc * appsrc, GstCaps * filter)
     gst_caps_ref (caps);
 
   if (filter) {
-    GstCaps *intersection =
-        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
-    gst_caps_unref (caps);
-    caps = intersection;
+    if (caps) {
+      GstCaps *intersection =
+          gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+      gst_caps_unref (caps);
+      caps = intersection;
+    } else {
+      caps = gst_caps_ref (filter);
+    }
   }
-
   GST_DEBUG_OBJECT (appsrc, "getting caps of %" GST_PTR_FORMAT, caps);
   GST_OBJECT_UNLOCK (appsrc);