qt/gloverlay: reset current OpenGL context after Qt
authorMatthew Waters <matthew@centricular.com>
Fri, 12 Jun 2020 02:16:49 +0000 (12:16 +1000)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 12 Jun 2020 07:23:19 +0000 (07:23 +0000)
Qt may replace the drawable with its own which breaks output if Qt is
not displaying the resulting video as used with e.g. glimagesink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/623>

ext/qt/qtglrenderer.cc

index ddd8acf..9a8d75d 100644 (file)
@@ -636,6 +636,12 @@ void GstQuickRenderer::initializeGstGL ()
         m_sharedRenderData->m_animationDriver->install();
     }
     g_mutex_unlock (&m_sharedRenderData->lock);
+    /* XXX: reset the OpenGL context drawable as Qt may have clobbered it.
+     * Fixes glimagesink output where Qt replaces the Surface to use in its
+     * own MakeCurrent call.  Qt does this on it's OpenGL initialisation
+     * the the rendering engine. */
+    gst_gl_context_activate (gl_context, FALSE);
+    gst_gl_context_activate (gl_context, TRUE);
 }
 
 void GstQuickRenderer::initializeQml()