pad: don't intersect with any in proxy_pad_get_caps

We initialize the caps with any and if a pad has NULL caps, just skip it instead
of intersecting with any. Also add branch prediction here.
This commit is contained in:
Stefan Kost 2009-10-01 17:39:45 +03:00
parent b1f88b3f1f
commit 82526701f0

View file

@ -2630,16 +2630,16 @@ static gboolean
intersect_caps_func (GstPad * pad, GValue * ret, GstPad * orig) intersect_caps_func (GstPad * pad, GValue * ret, GstPad * orig)
{ {
/* skip the pad, the request came from */ /* skip the pad, the request came from */
if (pad != orig) { if (G_UNLIKELY (pad != orig)) {
GstCaps *peercaps, *existing; GstCaps *peercaps, *existing;
existing = g_value_get_pointer (ret); existing = g_value_get_pointer (ret);
peercaps = gst_pad_peer_get_caps (pad); peercaps = gst_pad_peer_get_caps (pad);
if (peercaps == NULL) if (G_UNLIKELY (peercaps)) {
peercaps = gst_caps_new_any (); g_value_set_pointer (ret, gst_caps_intersect (existing, peercaps));
g_value_set_pointer (ret, gst_caps_intersect (existing, peercaps)); gst_caps_unref (existing);
gst_caps_unref (existing); gst_caps_unref (peercaps);
gst_caps_unref (peercaps); }
} }
gst_object_unref (pad); gst_object_unref (pad);
return TRUE; return TRUE;