From 747ae7d7693e4fc448f3b3229b44eaf9d85e4b04 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sat, 3 Aug 2019 13:14:53 -0400 Subject: [PATCH] gldownload: Wait on sync meta if any This is possibly not strictly needed when pixels are being downloaded to CPU memory, but would cause issue when exporting DMABuf, as the data may not be yet ready when the DMABuf reaches the consumer. --- ext/gl/gstgldownloadelement.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c index 7541ae680d..b7cf474a17 100644 --- a/ext/gl/gstgldownloadelement.c +++ b/ext/gl/gstgldownloadelement.c @@ -414,7 +414,15 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt, #if GST_GL_HAVE_PLATFORM_EGL && GST_GL_HAVE_DMABUF else if (dl->dmabuf_allocator) { GstBuffer *buffer = _try_export_dmabuf (dl, inbuf); + if (buffer) { + GstGLContext *context = GST_GL_BASE_FILTER (bt)->context; + GstGLSyncMeta *in_sync_meta; + + in_sync_meta = gst_buffer_get_gl_sync_meta (inbuf); + if (in_sync_meta) + gst_gl_sync_meta_wait (in_sync_meta, context); + if (GST_BASE_TRANSFORM_GET_CLASS (bt)->copy_metadata) if (!GST_BASE_TRANSFORM_GET_CLASS (bt)->copy_metadata (bt, inbuf, buffer)) {