gl/display/egl: Fix precondition in display_egl_get_from_native
authorMatthew Waters <matthew@centricular.com>
Thu, 8 Feb 2018 05:13:23 +0000 (16:13 +1100)
committerMatthew Waters <matthew@centricular.com>
Thu, 8 Feb 2018 05:16:59 +0000 (16:16 +1100)
We don't really want type=NONE as input and it was already impossible
for that to occur with the other condtions.

CID #1427144

gst-libs/gst/gl/egl/gstgldisplay_egl.c

index 448899c..81f9794 100644 (file)
@@ -90,7 +90,8 @@ gst_gl_display_egl_finalize (GObject * object)
  * @display: pointer to a display (or 0)
  *
  * Attempts to create a new #EGLDisplay from @display.  If @type is
- * %GST_GL_DISPLAY_TYPE_ANY, then @display must be 0.
+ * %GST_GL_DISPLAY_TYPE_ANY, then @display must be 0. @type must not be
+ * %GST_GL_DISPLAY_TYPE_NONE.
  *
  * Returns: A #EGLDisplay or %EGL_NO_DISPLAY
  *
@@ -103,19 +104,14 @@ gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display)
   EGLDisplay ret = EGL_NO_DISPLAY;
   _gst_eglGetPlatformDisplay_type _gst_eglGetPlatformDisplay;
 
+  g_return_val_if_fail (type != GST_GL_DISPLAY_TYPE_NONE, EGL_NO_DISPLAY);
   g_return_val_if_fail ((type != GST_GL_DISPLAY_TYPE_ANY && display != 0)
       || (type == GST_GL_DISPLAY_TYPE_ANY && display == 0), EGL_NO_DISPLAY);
-  g_return_val_if_fail ((type != GST_GL_DISPLAY_TYPE_NONE
-          || (type == GST_GL_DISPLAY_TYPE_NONE
-              && display == 0)), EGL_NO_DISPLAY);
 
   /* given an EGLDisplay already */
   if (type == GST_GL_DISPLAY_TYPE_EGL)
     return (gpointer) display;
 
-  if (type == GST_GL_DISPLAY_TYPE_NONE)
-    type = GST_GL_DISPLAY_TYPE_ANY;
-
   egl_exts = eglQueryString (EGL_NO_DISPLAY, EGL_EXTENSIONS);
   GST_DEBUG ("egl no display extensions: %s", egl_exts);