gl: error out if the configured GL API is unsupported by our element
authorMatthew Waters <matthew@centricular.com>
Mon, 22 Feb 2016 09:49:52 +0000 (20:49 +1100)
committerMatthew Waters <matthew@centricular.com>
Mon, 22 Feb 2016 09:52:54 +0000 (20:52 +1100)
https://bugzilla.gnome.org/show_bug.cgi?id=759801

ext/gl/gstglbasemixer.c

index ef90479..d207883 100644 (file)
@@ -489,11 +489,31 @@ gst_gl_base_mixer_decide_allocation (GstGLBaseMixer * mix, GstQuery * query)
     GST_OBJECT_UNLOCK (mix->display);
   }
 
+  {
+    GstGLAPI current_gl_api = gst_gl_context_get_gl_api (mix->context);
+    if ((current_gl_api & mix_class->supported_gl_api) == 0)
+      goto unsupported_gl_api;
+  }
+
   if (mix_class->decide_allocation)
     ret = mix_class->decide_allocation (mix, query);
 
   return ret;
 
+unsupported_gl_api:
+  {
+    GstGLAPI gl_api = gst_gl_context_get_gl_api (mix->context);
+    gchar *gl_api_str = gst_gl_api_to_string (gl_api);
+    gchar *supported_gl_api_str =
+        gst_gl_api_to_string (mix_class->supported_gl_api);
+    GST_ELEMENT_ERROR (mix, RESOURCE, BUSY,
+        ("GL API's not compatible context: %s supported: %s", gl_api_str,
+            supported_gl_api_str), (NULL));
+
+    g_free (supported_gl_api_str);
+    g_free (gl_api_str);
+    return FALSE;
+  }
 context_error:
   {
     GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s", error->message),