From: Edward Hervey Date: Thu, 22 Aug 2013 17:01:32 +0000 (+0200) Subject: basetransform: Don't push out identical caps X-Git-Tag: 1.1.4~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=307d67f8c067d202fbb01ed5f3d930cea3de67d0;p=platform%2Fupstream%2Fgstreamer.git basetransform: Don't push out identical caps This avoids triggering plenty of extra code/methods/overhead downstream when we can just quickly check whenever we want to set caps whether they are identical or not https://bugzilla.gnome.org/show_bug.cgi?id=706600 --- diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index df672bf873..83420dc0e6 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1298,7 +1298,7 @@ gst_base_transform_setcaps (GstBaseTransform * trans, GstPad * pad, GstCaps * incaps) { GstBaseTransformPrivate *priv = trans->priv; - GstCaps *outcaps; + GstCaps *outcaps, *prevcaps; gboolean ret = TRUE; GST_DEBUG_OBJECT (pad, "have new caps %p %" GST_PTR_FORMAT, incaps, incaps); @@ -1321,8 +1321,14 @@ gst_base_transform_setcaps (GstBaseTransform * trans, GstPad * pad, if (!(ret = gst_base_transform_configure_caps (trans, incaps, outcaps))) goto failed_configure; - /* let downstream know about our caps */ - ret = gst_pad_set_caps (trans->srcpad, outcaps); + prevcaps = gst_pad_get_current_caps (trans->srcpad); + + if (!prevcaps || !gst_caps_is_equal (outcaps, prevcaps)) + /* let downstream know about our caps */ + ret = gst_pad_set_caps (trans->srcpad, outcaps); + + if (prevcaps) + gst_caps_unref (prevcaps); if (ret) { /* try to get a pool when needed */