From f7eb93e22b1db5912fbe09ad4c52cc42a35260e8 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Mon, 1 Mar 2021 13:44:09 +0800 Subject: [PATCH] va: vpp: fix a wrong caps logic in vpp_transform_caps(). The current gst_va_vpp_transform_caps return such as: video/x-raw(memory:VAMemory), width=(int)[ 16, 16384 ], height=(int)[ 16, 16384 ], interlace-mode=(string)progressive, format=(string){ NV12, I420, YV12, YUY2, RGBA, BGRA, P010_10LE, ARGB, ABGR, VUYA }; video/x-raw(memory:DMABuf), width=(int)[ 16, 16384 ], height=(int)[ 16, 16384 ], interlace-mode=(string)progressive, format=(string) { NV12, I420, YV12, YUY2, RGBA, BGRA, P010_10LE, ARGB, ABGR, VUYA }; video/x-raw, width=(int)[ 16, 16384 ], height=(int)[ 16, 16384 ], interlace-mode=(string)progressive, format=(string){ VUYA, GRAY8, NV12, NV21, YUY2, UYVY, YV12, I420, P010_10LE }; video/x-raw(memory:VAMemory), width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], interlace-mode=(string)progressive; video/x-raw(memory:DMABuf), width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], interlace-mode=(string)progressive; video/x-raw, width=(int) [ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], interlace-mode=(string)progressive Which is not correct. It mixes the template caps and the input query caps together. The correct way should be: clip the template caps with the input caps(remove format and rangify size). The correct answer should be: video/x-raw(memory:VAMemory), width=(int)[ 16, 16384 ], height=(int)[ 16, 16384 ], interlace -mode=(string)progressive, format=(string){ NV12, I420, YV12, YUY2, RGBA, BGRA, P010_10LE, ARGB, ABGR, VUYA }; video/x-raw(memory:DMABuf), width=(int)[ 16, 16384 ], height=(int)[ 16, 16384 ], interlace-mode=(string)progressive, format=(string){ NV12, I420, YV12, YUY2, RGBA, BGRA, P010_10LE, ARGB, ABGR, VUYA }; video/x-raw, width=(int)[ 16, 16384 ], height=(int)[ 16, 16384 ], interlace-mode=(string)progressive, format=(string){ VUYA, GRAY8, NV12, NV21, YUY2, UYVY, YV12, I420, P010_10LE } Part-of: --- sys/va/gstvavpp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c index c27f5dc4bb..bcdcbb1bfc 100644 --- a/sys/va/gstvavpp.c +++ b/sys/va/gstvavpp.c @@ -1278,7 +1278,7 @@ gst_va_vpp_transform_caps (GstBaseTransform * trans, GstPadDirection direction, "Transforming caps %" GST_PTR_FORMAT " in direction %s", caps, (direction == GST_PAD_SINK) ? "sink" : "src"); - ret = gst_va_vpp_caps_remove_format_and_rangify_size_info (caps); + caps = gst_va_vpp_caps_remove_format_and_rangify_size_info (caps); if (direction == GST_PAD_SINK) { tmpl_caps = @@ -1287,7 +1287,9 @@ gst_va_vpp_transform_caps (GstBaseTransform * trans, GstPadDirection direction, tmpl_caps = gst_pad_get_pad_template_caps (GST_BASE_TRANSFORM_SINK_PAD (trans)); } - gst_caps_append (ret, tmpl_caps); + + ret = gst_caps_intersect_full (tmpl_caps, caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (tmpl_caps); if (filter) { GstCaps *intersection;