applemedia: avfvideosrc: small negotiation fix
authorAlessandro Decina <alessandro.d@gmail.com>
Wed, 6 Jan 2016 02:20:17 +0000 (13:20 +1100)
committerAlessandro Decina <alessandro.d@gmail.com>
Wed, 6 Jan 2016 02:20:17 +0000 (13:20 +1100)
Fix negotiation when GLMemory is requested but a context is not available

sys/applemedia/avfvideosrc.m

index 6d3390d..ab6b836 100644 (file)
@@ -1006,6 +1006,13 @@ caps_filter_out_gl_memory (GstCapsFeatures * features, GstStructure * structure,
   else
     gst_object_unref (context);
 
+  /* this can happen if video/x-raw(memory:GLMemory) is forced but a context is
+   * not available */
+  if (gst_caps_is_empty (new_caps)) {
+    GST_WARNING_OBJECT (element, "GLMemory requested but no context available");
+    return new_caps;
+  }
+
   new_caps = gst_caps_truncate (new_caps);
   structure = gst_caps_get_structure (new_caps, 0);
   /* crank up to 11. This is what the presets do, but we don't use the presets