From: Haihua Hu Date: Tue, 13 Jun 2023 02:30:16 +0000 (+0800) Subject: glfilter: add parent meta to output buffer for input buffer X-Git-Tag: 1.22.7~217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ab685c2a3e9786226fedcfff7c84cf137dee560;p=platform%2Fupstream%2Fgstreamer.git glfilter: add parent meta to output buffer for input buffer glfilter will unref input buffer after _transform() call immidiately, but gpu may still reading input buffer for rendering because gl api is executed async. Need hold reference for input buffer by adding parent meta to output buffer. Part-of: --- diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c index edb12b2..54bb050 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c @@ -1032,6 +1032,14 @@ gst_gl_filter_transform (GstBaseTransform * bt, GstBuffer * inbuf, if (out_sync_meta) gst_gl_sync_meta_set_sync_point (out_sync_meta, context); + /* since gl api is async operation, when return from transform() + * function, basetransform will unref input buffer immidiately, + * but gpu may still reading input buffer for rendering. Add parent + * buffer meta to hold one reference of inbuf, this can avoid this + * buffer sync problem. + */ + gst_buffer_add_parent_buffer_meta (outbuf, inbuf); + return ret ? GST_FLOW_OK : GST_FLOW_ERROR; }