plugins: set GL objects if context is handled
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 10 Oct 2017 15:14:15 +0000 (17:14 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 1 Nov 2017 10:27:36 +0000 (11:27 +0100)
Only set the GL display and GL other context if they are extracted
correctly from the gstreamer's context.

https://bugzilla.gnome.org/show_bug.cgi?id=773453

gst/vaapi/gstvaapipluginbase.c

index 1f81ac1..8318fa3 100644 (file)
@@ -80,9 +80,16 @@ gst_vaapi_plugin_base_set_context (GstVaapiPluginBase * plugin,
     plugin_set_display (plugin, display);
 
 #if USE_GST_GL_HELPERS
-  gst_gl_handle_set_context (GST_ELEMENT_CAST (plugin), context,
-      (GstGLDisplay **) & plugin->gl_display,
-      (GstGLContext **) & plugin->gl_other_context);
+  {
+    GstGLDisplay *gl_display = NULL;
+    GstGLContext *gl_other_context = NULL;
+    GstElement *el = GST_ELEMENT_CAST (plugin);
+
+    if (gst_gl_handle_set_context (el, context, &gl_display, &gl_other_context)) {
+      plugin->gl_display = (GstObject *) gl_display;
+      plugin->gl_other_context = (GstObject *) gl_other_context;
+    }
+  }
 #endif
 }