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
This commit is contained in:
Sjoerd Simons 2013-06-19 12:37:31 +02:00 committed by Sjoerd Simons
parent 5b32891ae1
commit 8e43c0ec9e

View file

@ -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)) {