basesrc: respect FIXED_CAPS flag in caps query implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3590>
This commit is contained in:
Mathieu Duponchelle 2022-12-17 00:36:49 +00:00 committed by GStreamer Marge Bot
parent 7c92ed0bd0
commit f8b732563b

View file

@ -1342,20 +1342,25 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query)
case GST_QUERY_CAPS: case GST_QUERY_CAPS:
{ {
GstBaseSrcClass *bclass; GstBaseSrcClass *bclass;
GstCaps *caps, *filter; GstCaps *caps = NULL, *filter;
bclass = GST_BASE_SRC_GET_CLASS (src); bclass = GST_BASE_SRC_GET_CLASS (src);
if (bclass->get_caps) { if (GST_PAD_IS_FIXED_CAPS (src->srcpad)) {
caps = gst_pad_get_current_caps (src->srcpad);
}
if (caps == NULL && bclass->get_caps) {
gst_query_parse_caps (query, &filter); gst_query_parse_caps (query, &filter);
if ((caps = bclass->get_caps (src, filter))) { caps = bclass->get_caps (src, filter);
gst_query_set_caps_result (query, caps); }
gst_caps_unref (caps);
res = TRUE; if (caps != NULL) {
} else { res = TRUE;
res = FALSE; gst_query_set_caps_result (query, caps);
} gst_caps_unref (caps);
} else } else {
res = FALSE; res = FALSE;
}
break; break;
} }
case GST_QUERY_URI:{ case GST_QUERY_URI:{