From a92167ea6e4b4d3a0fdf25d750a073ad99241ac7 Mon Sep 17 00:00:00 2001 From: Shengqi Yu Date: Mon, 29 Apr 2024 15:25:28 +0800 Subject: [PATCH] glmixer: Add GL_SYNC_META option to bufferpool when pipline is glvideomixerelement->glcolorconvertelement->gldownloadelement and glcolorconvertelement is not passthrough, the gl bufferpool between glvideomixerelement and glcolorconvertelement will not add gl sync meta during allocating buffer. This will cause that glcolorconvert's inbuf has no sync meta to wait for. Part-of: --- subprojects/gst-plugins-base/ext/gl/gstgldownloadelement.c | 7 +++++-- subprojects/gst-plugins-base/gst-libs/gst/gl/gstglmixer.c | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-base/ext/gl/gstgldownloadelement.c b/subprojects/gst-plugins-base/ext/gl/gstgldownloadelement.c index ee92ed4163..1a3bb7eaa1 100644 --- a/subprojects/gst-plugins-base/ext/gl/gstgldownloadelement.c +++ b/subprojects/gst-plugins-base/ext/gl/gstgldownloadelement.c @@ -23,6 +23,7 @@ #endif #include +#include #if GST_GL_HAVE_PLATFORM_EGL && GST_GL_HAVE_DMABUF #include #include @@ -1454,13 +1455,15 @@ gst_gl_download_element_propose_allocation (GstBaseTransform * bt, size = info.size; gst_buffer_pool_config_set_params (config, caps, size, 0, 0); gst_buffer_pool_config_set_gl_min_free_queue_size (config, 1); - gst_buffer_pool_config_add_option (config, - GST_BUFFER_POOL_OPTION_GL_SYNC_META); if (!gst_buffer_pool_set_config (pool, config)) { gst_object_unref (pool); goto config_failed; } + + if (context->gl_vtable->FenceSync) + gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL); + gst_query_add_allocation_pool (query, pool, size, 1, 0); gst_object_unref (pool); diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglmixer.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglmixer.c index 9a891b65f6..5e1bed1c1f 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglmixer.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglmixer.c @@ -239,7 +239,7 @@ gst_gl_mixer_propose_allocation (GstAggregator * agg, /* we also support various metadata */ if (context->gl_vtable->FenceSync) - gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0); + gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL); return TRUE; @@ -644,6 +644,9 @@ gst_gl_mixer_decide_allocation (GstAggregator * agg, GstQuery * query) gst_buffer_pool_config_set_params (config, caps, size, min, max); gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); + if (gst_query_find_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL)) + gst_buffer_pool_config_add_option (config, + GST_BUFFER_POOL_OPTION_GL_SYNC_META); gst_buffer_pool_set_config (pool, config);