mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
utils: speed up pad linking utility functions by not trying pads that will never work
In gst_element_get_compatible_pad(), when trying to find a compatible pad on an element for a given pad, there's no point in checking the element's sink pads if the pad to link is a sink pad as well, or the element's source pads if the given pad is a source pad already, since those would never be able to link anyway. Should speed up linking using the convenience functions a little bit, or at least reduce debug log output.
This commit is contained in:
parent
f547482e7c
commit
18ecca6331
1 changed files with 9 additions and 1 deletions
|
@ -1117,8 +1117,16 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
|
|||
g_return_val_if_fail (GST_PAD_PEER (pad) == NULL, NULL);
|
||||
|
||||
done = FALSE;
|
||||
|
||||
/* try to get an existing unlinked pad */
|
||||
pads = gst_element_iterate_pads (element);
|
||||
if (GST_PAD_IS_SRC (pad)) {
|
||||
pads = gst_element_iterate_sink_pads (element);
|
||||
} else if (GST_PAD_IS_SINK (pad)) {
|
||||
pads = gst_element_iterate_src_pads (element);
|
||||
} else {
|
||||
pads = gst_element_iterate_pads (element);
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
gpointer padptr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue