From 2f3033cebe3c76042beb6139577de3be43d726d5 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Mon, 1 Mar 2021 23:33:29 +0800 Subject: [PATCH] gl: download: Fix the wrong transformed result from src direction in transform_caps(). The current manner in transform_caps() for src direction is not very correct. For example, when the src caps is: video/x-raw(memory:DMABuf); video/x-raw; video/x-raw(memory:GLMemory) this function returns: video/x-raw(memory:DMABuf); video/x-raw; video/x-raw(memory:GLMemory) as the sink caps. This is not correct, because DMABuf feature is not even in the sink pad's caps template. The correct answer should be: video/x-raw(memory:GLMemory); video/x-raw only. Part-of: --- ext/gl/gstgldownloadelement.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c index ddd6ae2f68..f1f0f6c448 100644 --- a/ext/gl/gstgldownloadelement.c +++ b/ext/gl/gstgldownloadelement.c @@ -209,8 +209,11 @@ gst_gl_download_element_transform_caps (GstBaseTransform * bt, GstCaps *result, *tmp; if (direction == GST_PAD_SRC) { - tmp = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY); - tmp = gst_caps_merge (gst_caps_ref (caps), tmp); + GstCaps *sys_caps = gst_caps_simplify (_set_caps_features (caps, + GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY)); + + tmp = _set_caps_features (sys_caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY); + tmp = gst_caps_merge (tmp, sys_caps); } else { GstCaps *newcaps; tmp = gst_caps_ref (caps);