GstPad: Do not call gst_pad_accept_caps() when caps change
authorEdward Hervey <bilboed@bilboed.com>
Fri, 25 Jun 2010 14:31:06 +0000 (16:31 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 16 Jul 2010 13:30:55 +0000 (15:30 +0200)
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

gst/gstpad.c

index 0e0f7de..14aebc9 100644 (file)
@@ -2706,7 +2706,7 @@ gst_pad_configure_sink (GstPad * pad, GstCaps * caps)
   gboolean res;
 
   /* 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;
 
   /* set caps on pad if call succeeds */