decodebin: use can_intersect to avoid a caps copy

This commit is contained in:
Stefan Kost 2010-05-06 09:12:32 +03:00
parent 2e3cfe4546
commit 34f8ab5751

View file

@ -631,23 +631,21 @@ find_compatibles (GstDecodeBin * decode_bin, const GstCaps * caps)
/* we only care about the sink templates */
if (templ->direction == GST_PAD_SINK) {
GstCaps *intersect;
gboolean can_intersect;
GstCaps *tmpl_caps;
/* try to intersect the caps with the caps of the template */
tmpl_caps = gst_static_caps_get (&templ->static_caps);
intersect = gst_caps_intersect (caps, tmpl_caps);
can_intersect = gst_caps_can_intersect (caps, tmpl_caps);
gst_caps_unref (tmpl_caps);
/* check if the intersection is empty */
if (!gst_caps_is_empty (intersect)) {
if (can_intersect) {
/* non empty intersection, we can use this element */
to_try = g_list_prepend (to_try, factory);
gst_caps_unref (intersect);
break;
}
gst_caps_unref (intersect);
}
}
}