diff options
author | He Junyan <junyan.he@intel.com> | 2020-11-04 17:02:13 +0800 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-12-04 10:06:08 +0200 |
commit | 5f4e2cd196883a66380d74c67704cd49e03774bd (patch) | |
tree | a1fb522ea5720dd330b2174a97a220d9649265cb | |
parent | b5bd6b6f7897242154e05922164a2af71910a77d (diff) | |
download | gstreamer-plugins-base-5f4e2cd196883a66380d74c67704cd49e03774bd.tar.gz |
gluploadelement: Avoid race condition of base class' context.
The base class' context may change, we should use the common API
with lock to access it, rather than the just directly access the
struct field.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/921>
-rw-r--r-- | ext/gl/gstgluploadelement.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c index a4d16501f..1cda4c25e 100644 --- a/ext/gl/gstgluploadelement.c +++ b/ext/gl/gstgluploadelement.c @@ -167,7 +167,7 @@ _gst_gl_upload_element_transform_caps (GstBaseTransform * bt, if (base_filter->display && !gst_gl_base_filter_find_gl_context (base_filter)) return NULL; - context = GST_GL_BASE_FILTER (bt)->context; + context = gst_gl_base_filter_get_gl_context (base_filter); GST_OBJECT_LOCK (upload); if (upload->upload == NULL) { @@ -191,7 +191,10 @@ _gst_gl_upload_element_transform_caps (GstBaseTransform * bt, ret_caps = gst_gl_upload_transform_caps (ul, context, direction, caps, filter); + gst_object_unref (ul); + if (context) + gst_object_unref (context); return ret_caps; } |