From 27427c00c0c4f240ff0cce877eb52759292cd89c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Sun, 20 Sep 2020 09:56:40 +0200 Subject: [PATCH] decoder: don't reply src caps query with allowed if pad is fixed If the pad is already fixed the caps query have to be reply with the current fixed caps. Otherwise the query has to be replied with the autogeneratd src caps. This path fix this by falling back to the normal caps query processing if the pad is already fixed. Otherwise it will fetch the allowed src pad caps. Part-of: --- gst/vaapi/gstvaapidecode.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 9e8aa26415..329c0e65c6 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -1437,26 +1437,32 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query) GstElement *const element = GST_ELEMENT (vdec); switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_CAPS:{ - GstCaps *caps, *filter = NULL; - - gst_query_parse_caps (query, &filter); - caps = gst_vaapidecode_get_allowed_srcpad_caps (GST_VAAPIDECODE (vdec)); - - if (filter) { - GstCaps *tmp = caps; - caps = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (tmp); - } - - gst_query_set_caps_result (query, caps); - gst_caps_unref (caps); - break; - } case GST_QUERY_CONTEXT:{ ret = gst_vaapi_handle_context_query (element, query); break; } + case GST_QUERY_CAPS:{ + GstCaps *caps, *filter = NULL; + gboolean fixed_caps; + + fixed_caps = GST_PAD_IS_FIXED_CAPS (GST_VIDEO_DECODER_SRC_PAD (vdec)); + if (!fixed_caps) { + gst_query_parse_caps (query, &filter); + caps = gst_vaapidecode_get_allowed_srcpad_caps (GST_VAAPIDECODE (vdec)); + + if (filter) { + GstCaps *tmp = caps; + caps = + gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (tmp); + } + + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); + break; + } + /* else jump to default */ + } default:{ ret = GST_VIDEO_DECODER_CLASS (parent_class)->src_query (vdec, query); break;