glfilter: silence a warning with empty input caps
authorMatthew Waters <matthew@centricular.com>
Sun, 28 Sep 2014 11:18:32 +0000 (21:18 +1000)
committerMatthew Waters <matthew@centricular.com>
Sun, 28 Sep 2014 11:18:32 +0000 (21:18 +1000)
discovered with the doublecube example

gst_caps_get_features: assertion 'index < GST_CAPS_LEN (caps)' failed

gst-libs/gst/gl/gstglfilter.c

index de4a1affc07bbe9e5e24e8ef5c5c43ce14ccb44d..c04275006ac1cbf86ef8a214b871634c350cec46 100644 (file)
@@ -774,14 +774,16 @@ gst_gl_filter_transform_caps (GstBaseTransform * bt,
     result = tmp;
   }
 
-  /* if output still intersects input then prefer the intersection */
-  f = gst_caps_get_features (caps, 0);
-
-  if (!gst_caps_features_is_any (f)
-      && !gst_caps_features_is_equal (f,
-          GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) {
-    tmp = gst_caps_intersect_full (result, caps, GST_CAPS_INTERSECT_FIRST);
-    result = gst_caps_merge (tmp, result);
+  if (gst_caps_get_size (caps) > 0) {
+    f = gst_caps_get_features (caps, 0);
+    /* if output still intersects input then prefer the intersection */
+
+    if (!gst_caps_features_is_any (f)
+        && !gst_caps_features_is_equal (f,
+            GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) {
+      tmp = gst_caps_intersect_full (result, caps, GST_CAPS_INTERSECT_FIRST);
+      result = gst_caps_merge (tmp, result);
+    }
   }
 
   GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, result);