pad: check template caps for proxy pads in accept-caps

Validate that the proxy pad indeed accepts the caps by also
comparing with the pad template caps, otherwise when the pad
had no internally linked pads it would always return true.

https://bugzilla.gnome.org/show_bug.cgi?id=754112
This commit is contained in:
Thiago Santos 2015-11-05 16:15:22 -03:00
parent 2c132becb4
commit 02d88fc3f3

View file

@ -2982,7 +2982,7 @@ static gboolean
gst_pad_query_accept_caps_default (GstPad * pad, GstQuery * query)
{
/* get the caps and see if it intersects to something not empty */
GstCaps *caps, *allowed;
GstCaps *caps, *allowed = NULL;
gboolean result;
GST_DEBUG_OBJECT (pad, "query accept-caps %" GST_PTR_FORMAT, query);
@ -2991,17 +2991,21 @@ gst_pad_query_accept_caps_default (GstPad * pad, GstQuery * query)
* a PROXY CAPS */
if (GST_PAD_IS_PROXY_CAPS (pad)) {
result = gst_pad_proxy_query_accept_caps (pad, query);
goto done;
if (result)
allowed = gst_pad_get_pad_template_caps (pad);
else
goto done;
}
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, pad,
"fallback ACCEPT_CAPS query, consider implementing a specialized version");
gst_query_parse_accept_caps (query, &caps);
if (GST_PAD_IS_ACCEPT_TEMPLATE (pad))
allowed = gst_pad_get_pad_template_caps (pad);
else
allowed = gst_pad_query_caps (pad, caps);
if (!allowed) {
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, pad,
"fallback ACCEPT_CAPS query, consider implementing a specialized version");
if (GST_PAD_IS_ACCEPT_TEMPLATE (pad))
allowed = gst_pad_get_pad_template_caps (pad);
else
allowed = gst_pad_query_caps (pad, caps);
}
if (allowed) {
if (GST_PAD_IS_ACCEPT_INTERSECT (pad)) {