From 46e26824d456af90d6d0a9117b38929af71414d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 7 Sep 2011 14:19:32 +0200 Subject: [PATCH] decodebin2: Intersect the factory caps with the current caps for the capsfilter Otherwise we'll include many incompatible caps in the capsfilter that will only slow down negotiation. --- gst/playback/gstdecodebin2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 322ae285f3..5c397936a8 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1555,7 +1555,7 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad, for (i = 0; i < factories->n_values; i++) { GstElementFactory *factory = g_value_get_object (g_value_array_get_nth (factories, i)); - GstCaps *tcaps; + GstCaps *tcaps, *intersection; const GList *tmps; GST_DEBUG ("Trying factory %s", @@ -1572,7 +1572,9 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad, if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS) continue; tcaps = gst_static_pad_template_get_caps (st); - gst_caps_merge (filter_caps, gst_caps_copy (tcaps)); + intersection = + gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_merge (filter_caps, intersection); gst_caps_unref (tcaps); } }