From a171eb80d6d809e3be3cd0531e499dde3c3a3f33 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 4 Feb 2020 14:14:38 +1100 Subject: [PATCH] glcolorconvert: error out if memory context is different than ours --- gst-libs/gst/gl/gstglcolorconvert.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 9d11c9e..2758d16 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -2366,6 +2366,14 @@ _do_convert_one_view (GstGLContext * context, GstGLColorConvert * convert, res = FALSE; goto out; } + if (convert->context != convert->priv->in_tex[i]->mem.context) { + GST_ERROR_OBJECT (convert, "input memory OpenGL context is different. " + "we have %" GST_PTR_FORMAT " memory has %" GST_PTR_FORMAT, + convert->context, convert->priv->in_tex[i]->mem.context); + res = FALSE; + goto out; + } + if (!gst_memory_map ((GstMemory *) convert->priv->in_tex[i], &in_info[i], GST_MAP_READ | GST_MAP_GL)) { GST_ERROR_OBJECT (convert, "failed to map input memory %p", @@ -2386,6 +2394,13 @@ _do_convert_one_view (GstGLContext * context, GstGLColorConvert * convert, res = FALSE; goto out; } + if (convert->context != out_tex->mem.context) { + GST_ERROR_OBJECT (convert, "output memory OpenGL context is different. " + "we have %" GST_PTR_FORMAT " memory has %" GST_PTR_FORMAT, + convert->context, out_tex->mem.context); + res = FALSE; + goto out; + } mem_width = gst_gl_memory_get_texture_width (out_tex); mem_height = gst_gl_memory_get_texture_height (out_tex); -- 2.7.4