From 414f91d0fa7702d1f6ae06a5a154209c56956312 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Thu, 25 May 2023 11:11:40 +0800 Subject: [PATCH] glupload: make meta upload manner only consider TextureUploadMeta feature The current _upload_meta_upload_transform_caps() only simply apply "memory:GLMemory" to all input caps to transform the output caps. This is not precise and may cause problem. For example, if the input caps include: video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \ interlace-mode=(string)progressive, multiview-mode=(string)mono, \ framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002 it will be changed as video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \ interlace-mode=(string)progressive, multiview-mode=(string)mono, \ framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002 For GLMemory kind caps, no drm-format should appear. So we should let it only transforms which it can recognize. Part-of: --- .../gst-plugins-base/gst-libs/gst/gl/gstglupload.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglupload.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglupload.c index 7555b4a699..679344790c 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglupload.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglupload.c @@ -1784,14 +1784,24 @@ _upload_meta_upload_transform_caps (gpointer impl, GstGLContext * context, GstCapsFeatures *passthrough = gst_caps_features_from_string (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); + GstCapsFeatures *filter_features; GstCaps *ret; if (direction == GST_PAD_SINK) { GstCaps *tmp; - ret = - _set_caps_features_with_passthrough (caps, + filter_features = gst_caps_features_from_string + (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META); + if (!_filter_caps_with_features (caps, filter_features, &tmp)) { + gst_caps_features_free (filter_features); + gst_caps_features_free (passthrough); + return NULL; + } + gst_caps_features_free (filter_features); + + ret = _set_caps_features_with_passthrough (tmp, GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough); + gst_caps_unref (tmp); tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D); gst_caps_unref (ret);