From 8e43c0ec9ea627d3cea0cecf6d3e168bf4d5d09e Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 19 Jun 2013 12:37:31 +0200 Subject: [PATCH] v4l2: Optimize negotiation by removing the query filter As cameras tend to have a quite specific set of capabilities (specific framerates for each resolution), getting the peer caps filtered by our probed caps can cause a big increase in the caps size which slows down things quire a bit. As for negotiation v4l2 iterates through the caps of the peer to find the first intersection with the probed caps, getting the fully expanded intersection of capabilities is not useful. Using the same testcase as for bug #702632, adding this patch on top of the patches suggested there speeds up getting the inital frame from around ~14-15 seconds to around ~3-4 seconds. https://bugzilla.gnome.org/show_bug.cgi?id=702638 --- sys/v4l2/gstv4l2src.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 9f5c92e23c..107ea21ba5 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -330,8 +330,8 @@ gst_v4l2src_negotiate (GstBaseSrc * basesrc) if (thiscaps == NULL || gst_caps_is_any (thiscaps)) goto no_nego_needed; - /* get the peer caps */ - peercaps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (basesrc), thiscaps); + /* get the peer caps without a filter as we'll filter ourselves later on */ + peercaps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (basesrc), NULL); GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps); LOG_CAPS (basesrc, peercaps); if (peercaps && !gst_caps_is_any (peercaps)) {