From f0040149a014c61dc21c8e465abd664d4d96230f Mon Sep 17 00:00:00 2001 From: Anders Hellerup Madsen Date: Mon, 6 Feb 2023 16:15:46 +0100 Subject: [PATCH] glbasefilter: use gst_display_ensure_context Part-of: --- .../gst-libs/gst/gl/gstglbasefilter.c | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasefilter.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasefilter.c index c9678f60bd..f09ca3eeb5 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasefilter.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasefilter.c @@ -556,24 +556,11 @@ gst_gl_base_filter_find_gl_context_unlocked (GstGLBaseFilter * filter) return FALSE; } - if (!filter->context) { - GST_OBJECT_LOCK (filter->display); - do { - if (filter->context) - gst_object_unref (filter->context); - /* just get a GL context. we don't care */ - filter->context = - gst_gl_display_get_gl_context_for_thread (filter->display, NULL); - if (!filter->context) { - if (!gst_gl_display_create_context (filter->display, - filter->priv->other_context, &filter->context, &error)) { - GST_OBJECT_UNLOCK (filter->display); - goto context_error; - } - } - } while (!gst_gl_display_add_context (filter->display, filter->context)); - GST_OBJECT_UNLOCK (filter->display); + if (!gst_gl_display_ensure_context (filter->display, + filter->priv->other_context, &filter->context, &error)) { + goto context_error; } + GST_INFO_OBJECT (filter, "found OpenGL context %" GST_PTR_FORMAT, filter->context);