From 7bee4619dd7e375c6b7657585c37acde2f957b2a Mon Sep 17 00:00:00 2001 From: Anders Hellerup Madsen Date: Mon, 6 Feb 2023 16:14:34 +0100 Subject: [PATCH] glbasesrc: use gst_display_ensure_context Part-of: --- .../gst-libs/gst/gl/gstglbasesrc.c | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasesrc.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasesrc.c index fa283459c0..cd4b20f2a5 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasesrc.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasesrc.c @@ -555,25 +555,9 @@ gst_gl_base_src_find_gl_context_unlocked (GstGLBaseSrc * src) _find_local_gl_context_unlocked (src); - if (!src->context) { - GST_OBJECT_LOCK (src->display); - do { - if (src->context) { - gst_object_unref (src->context); - src->context = NULL; - } - /* just get a GL context. we don't care */ - src->context = - gst_gl_display_get_gl_context_for_thread (src->display, NULL); - if (!src->context) { - if (!gst_gl_display_create_context (src->display, - src->priv->other_context, &src->context, &error)) { - GST_OBJECT_UNLOCK (src->display); - goto context_error; - } - } - } while (!gst_gl_display_add_context (src->display, src->context)); - GST_OBJECT_UNLOCK (src->display); + if (!gst_gl_display_ensure_context (src->display, src->priv->other_context, + &src->context, &error)) { + goto context_error; } GST_INFO_OBJECT (src, "found OpenGL context %" GST_PTR_FORMAT, src->context);