GstPad: Do not call gst_pad_accept_caps() when caps change

Instead just check that the caps intersect with the pad template.
The elements should properly accept/refuse the caps in setcaps().

Shaves off calling the default implementation of acceptcaps which does
an expensive gst_pad_get_caps() (so if you have 50 of those elements in
a row, you'd be doing factorial(50) gst_pad_get_caps...).

Does not break any module unit test and most apps work fine.

https://bugzilla.gnome.org/show_bug.cgi?id=622740
This commit is contained in:
Edward Hervey 2010-06-25 16:31:06 +02:00
parent 5b40ebbceb
commit 7fa58dbebd

View file

@ -2706,7 +2706,7 @@ gst_pad_configure_sink (GstPad * pad, GstCaps * caps)
gboolean res; gboolean res;
/* See if pad accepts the caps */ /* See if pad accepts the caps */
if (!gst_pad_accept_caps (pad, caps)) if (!gst_caps_can_intersect (caps, gst_pad_get_pad_template_caps (pad)))
goto not_accepted; goto not_accepted;
/* set caps on pad if call succeeds */ /* set caps on pad if call succeeds */