glbasefilter: use gst_display_ensure_context

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3843>
This commit is contained in:
Anders Hellerup Madsen 2023-02-06 16:15:46 +01:00
parent ecd9a4e37c
commit f0040149a0

View file

@ -556,24 +556,11 @@ gst_gl_base_filter_find_gl_context_unlocked (GstGLBaseFilter * filter)
return FALSE; return FALSE;
} }
if (!filter->context) { if (!gst_gl_display_ensure_context (filter->display,
GST_OBJECT_LOCK (filter->display); filter->priv->other_context, &filter->context, &error)) {
do { goto context_error;
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);
} }
GST_INFO_OBJECT (filter, "found OpenGL context %" GST_PTR_FORMAT, GST_INFO_OBJECT (filter, "found OpenGL context %" GST_PTR_FORMAT,
filter->context); filter->context);