diff options
author | Matthew Waters <matthew@centricular.com> | 2020-02-04 14:01:47 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2020-02-11 11:38:46 +1100 |
commit | e048b9fd564db8ad4b0c4880c2ee37a8254c08c3 (patch) | |
tree | e28e53423312793edcf79513b412042caccad5bb | |
parent | 259196448e2c0131d8f7b508120f7e4050f5f585 (diff) | |
download | gstreamer-plugins-base-e048b9fd564db8ad4b0c4880c2ee37a8254c08c3.tar.gz |
glviewconvert: fix reset context for GL context change
We need to remove GL resources from the old context instead of the new
GL context. The two GL context may not even be shared.
-rw-r--r-- | gst-libs/gst/gl/gstglviewconvert.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c index ce4fad0cb..fe9053761 100644 --- a/gst-libs/gst/gl/gstglviewconvert.c +++ b/gst-libs/gst/gl/gstglviewconvert.c @@ -358,11 +358,20 @@ void gst_gl_view_convert_set_context (GstGLViewConvert * viewconvert, GstGLContext * context) { + GstGLContext *old_context = NULL; + g_return_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert)); - if (gst_object_replace ((GstObject **) & viewconvert->context, - GST_OBJECT (context))) + GST_OBJECT_LOCK (viewconvert); + if (context != viewconvert->context) { gst_gl_view_convert_reset (viewconvert); + if (viewconvert->context) + old_context = viewconvert->context; + viewconvert->context = context ? gst_object_ref (context) : NULL; + } + GST_OBJECT_UNLOCK (viewconvert); + + gst_clear_object (&old_context); } static gboolean |