From 3aaef921c5493df57c78be1f46c1925d0a49bc53 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 11 Feb 2011 17:47:17 -0300 Subject: [PATCH] basetransform: Check for pad alloc caps when suggestion is not fixed If after computing the suggestion with downstream caps we still have a non-fixed suggestion caps try to intersect with the input caps of the pad alloc to avoid useless renegotiations. https://bugzilla.gnome.org/show_bug.cgi?id=642130 --- libs/gst/base/gstbasetransform.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 57192ab09f..d8b953c37c 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1757,6 +1757,20 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size, if (gst_caps_is_empty (sink_suggest)) goto not_supported; + /* try the alloc caps if it is still not fixed */ + if (!gst_caps_is_fixed (sink_suggest)) { + GstCaps *intersect; + + GST_DEBUG_OBJECT (trans, "Checking if the input caps is compatible " + "with the non-fixed caps suggestion"); + intersect = gst_caps_intersect (sink_suggest, caps); + if (!gst_caps_is_empty (intersect)) { + GST_DEBUG_OBJECT (trans, "It is, using it"); + gst_caps_replace (&sink_suggest, caps); + } + gst_caps_unref (intersect); + } + /* be safe and call default fixate */ sink_suggest = gst_caps_make_writable (sink_suggest); gst_pad_fixate_caps (GST_BASE_TRANSFORM_SINK_PAD (trans), sink_suggest);