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: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/397>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-09-20 09:56:40 +02:00
parent 6305acc9d3
commit 27427c00c0

View file

@ -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;