glimagesink: only allow setting the GL display/context if it is a valid value

Otherwise, when setting the external application context, then the
display may be cleared and then not used and the asharing mechanism does
not work anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2757>
This commit is contained in:
Matthew Waters 2022-07-12 14:47:20 +10:00 committed by Tim-Philipp Müller
parent dbe6699433
commit cb73ad2b6f

View file

@ -1211,8 +1211,10 @@ gst_glimage_sink_set_context (GstElement * element, GstContext * context)
GstGLDisplay *display = NULL;
gst_gl_handle_set_context (element, context, &display, &other_context);
_set_other_context (gl_sink, other_context);
_set_display (gl_sink, display);
if (display)
_set_display (gl_sink, display);
if (other_context)
_set_other_context (gl_sink, other_context);
if (gl_sink->display)
gst_gl_display_filter_gl_api (gl_sink->display, SUPPORTED_GL_APIS);