Compare commits

...

1 Commits

Author SHA1 Message Date
Chun-wei Fan
4625b3c8a2 GStreamer Media backend: Pass WGL context ownership back to GdkGL
We have no good way to know whether GStreamer is able to playback the file that
was fed into it, and when it couldn't (for instance, the installed plugins
cannot support decoding the file format), the control of the underlying WGL
context is in the GstGL's thread, not GTK's own thread.

As a result, we can't just do GdkGLContext calls directly in such scenarios,
otherwise the program crashes as the function pointers held by libepoxy (used
by GdkGLContext) are rendered invalid.  So, to be safe, if OpenGL (WGL) is
used, call epoxy_handle_external_wglMakeCurrent() upon sink disposal.

Fixes issue #5685.
2023-03-22 14:55:20 +08:00

View File

@@ -677,6 +677,12 @@ gtk_gst_sink_dispose (GObject *object)
{
GtkGstSink *self = GTK_GST_SINK (object);
#if GST_GL_HAVE_WINDOW_WIN32 && (GST_GL_HAVE_PLATFORM_WGL || GST_GL_HAVE_PLATFORM_EGL) && defined (GDK_WINDOWING_WIN32)
/* Windows: Tell libepoxy that we are going back to the GdkGLContext now */
if (self->gdk_context != NULL)
handle_wgl_makecurrent (self->gdk_context);
#endif
g_clear_object (&self->paintable);
g_clear_object (&self->gst_gdk_context);
g_clear_object (&self->gst_display);