mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
glwindow: track context activation properly
We only need to deactivate/reactivate the context iff it was already active.
This commit is contained in:
parent
6cb6d8f9e8
commit
ab9eb432fb
1 changed files with 19 additions and 3 deletions
|
@ -300,12 +300,28 @@ _set_window_handle_cb (GstSetWindowHandleCb * data)
|
||||||
{
|
{
|
||||||
GstGLContext *context = gst_gl_window_get_context (data->window);
|
GstGLContext *context = gst_gl_window_get_context (data->window);
|
||||||
GstGLWindowClass *window_class = GST_GL_WINDOW_GET_CLASS (data->window);
|
GstGLWindowClass *window_class = GST_GL_WINDOW_GET_CLASS (data->window);
|
||||||
|
GThread *thread = NULL;
|
||||||
|
|
||||||
|
/* deactivate if necessary */
|
||||||
|
if (context) {
|
||||||
|
thread = gst_gl_context_get_thread (context);
|
||||||
|
if (thread) {
|
||||||
|
/* This is only thread safe iff the context thread == g_thread_self() */
|
||||||
|
g_assert (thread == g_thread_self ());
|
||||||
|
gst_gl_context_activate (context, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gst_gl_context_activate (context, FALSE);
|
|
||||||
window_class->set_window_handle (data->window, data->handle);
|
window_class->set_window_handle (data->window, data->handle);
|
||||||
gst_gl_context_activate (context, TRUE);
|
|
||||||
|
|
||||||
gst_object_unref (context);
|
/* reactivate */
|
||||||
|
if (context && thread)
|
||||||
|
gst_gl_context_activate (context, TRUE);
|
||||||
|
|
||||||
|
if (context)
|
||||||
|
gst_object_unref (context);
|
||||||
|
if (thread)
|
||||||
|
g_thread_unref (thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue