From: Stefan Kost Date: Thu, 6 May 2010 13:51:16 +0000 (+0300) Subject: basesrc: reflow to truncate caps just once X-Git-Tag: RELEASE-0.10.30~184 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1c2071300c9c6e9e5ae1704effd28aae79c88df;p=platform%2Fupstream%2Fgstreamer.git basesrc: reflow to truncate caps just once We get writable caps from the intersection (unless it failed). As we truncate those anyway, we don't need to manualy copy the first structure. --- diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index c6d84dd..9fb42df 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2592,23 +2592,17 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc) peercaps = gst_pad_peer_get_caps_reffed (GST_BASE_SRC_PAD (basesrc)); GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps); if (peercaps) { - GstCaps *icaps; - /* get intersection */ - icaps = gst_caps_intersect (thiscaps, peercaps); - GST_DEBUG_OBJECT (basesrc, "intersect: %" GST_PTR_FORMAT, icaps); + caps = gst_caps_intersect (thiscaps, peercaps); + GST_DEBUG_OBJECT (basesrc, "intersect: %" GST_PTR_FORMAT, caps); gst_caps_unref (thiscaps); gst_caps_unref (peercaps); - if (icaps) { - /* take first (and best, since they are sorted) possibility */ - caps = gst_caps_copy_nth (icaps, 0); - gst_caps_unref (icaps); - } } else { /* no peer, work with our own caps then */ caps = thiscaps; } if (caps) { + /* take first (and best, since they are sorted) possibility */ caps = gst_caps_make_writable (caps); gst_caps_truncate (caps);