mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
utils: use caps when getting a compatible pad by template
Do not ignore the caps argument when requesting a pad by template. This is particularly harmful when the pad caps query by default returns ANY so it will match the first template instead of the one that actually intersects with the caps. https://bugzilla.gnome.org/show_bug.cgi?id=751235
This commit is contained in:
parent
cba677bebb
commit
1418e9e85c
1 changed files with 6 additions and 1 deletions
|
@ -1099,8 +1099,13 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
|
|||
|
||||
/* try to create a new one */
|
||||
/* requesting is a little crazy, we need a template. Let's create one */
|
||||
/* FIXME: why not gst_pad_get_pad_template (pad); */
|
||||
templcaps = gst_pad_query_caps (pad, NULL);
|
||||
if (caps) {
|
||||
GstCaps *inter = gst_caps_intersect (templcaps, caps);
|
||||
|
||||
gst_caps_unref (templcaps);
|
||||
templcaps = inter;
|
||||
}
|
||||
templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad),
|
||||
GST_PAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps);
|
||||
gst_caps_unref (templcaps);
|
||||
|
|
Loading…
Reference in a new issue