mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
switchbin: Always respond to caps query with all allowed caps
The caps query specifies _all_ caps that the element can handle, not just caps from the current path element. If for example a switchbin has two paths, with one having an element that handles video/x-h264, and another path whose element handles video/x-raw, and the second path is the current path, then the existing code would report only video/x-raw as supported. Fix this by report all allowed caps, even if there is a current path defined. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4632>
This commit is contained in:
parent
c994f27f34
commit
cfe484d983
1 changed files with 7 additions and 24 deletions
|
@ -512,38 +512,21 @@ gst_switch_bin_handle_query (GstPad * pad, GstObject * parent, GstQuery * query,
|
|||
|
||||
gst_query_parse_caps (query, &filter);
|
||||
|
||||
GST_DEBUG_OBJECT (switch_bin, "new caps query; filter: %" GST_PTR_FORMAT,
|
||||
filter);
|
||||
|
||||
PATH_LOCK (switch_bin);
|
||||
|
||||
if (switch_bin->num_paths == 0) {
|
||||
/* No paths exist - cannot return any caps */
|
||||
GST_DEBUG_OBJECT (switch_bin, "no paths exist; "
|
||||
"cannot return any caps to query");
|
||||
caps = NULL;
|
||||
} else if ((switch_bin->current_path == NULL)
|
||||
|| (switch_bin->current_path->element == NULL)) {
|
||||
/* Paths exist, but there is no current path (or the path currently
|
||||
* does not have an element) - just return all allowed caps */
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (switch_bin, "returning all allowed caps to query");
|
||||
caps =
|
||||
gst_switch_bin_get_allowed_caps (switch_bin, pad, pad_name, filter);
|
||||
} else {
|
||||
/* Paths exist and there is a current path
|
||||
* Forward the query to its element */
|
||||
|
||||
GstQuery *caps_query = gst_query_new_caps (NULL);
|
||||
GstPad *element_pad =
|
||||
gst_element_get_static_pad (switch_bin->current_path->element,
|
||||
pad_name);
|
||||
|
||||
caps = NULL;
|
||||
if (gst_pad_query (element_pad, caps_query)) {
|
||||
GstCaps *query_caps;
|
||||
gst_query_parse_caps_result (caps_query, &query_caps);
|
||||
caps = gst_caps_copy (query_caps);
|
||||
}
|
||||
|
||||
gst_query_unref (caps_query);
|
||||
gst_object_unref (GST_OBJECT (element_pad));
|
||||
}
|
||||
|
||||
|
||||
PATH_UNLOCK (switch_bin);
|
||||
|
||||
if (caps != NULL) {
|
||||
|
|
Loading…
Reference in a new issue