summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2014-07-08 14:31:59 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-07-25 14:18:47 -0400
commit3df949c7454b39d0394c4d9c6583393972edeff0 (patch)
treeb002a70beb37fd36f16a605e3972c0a671d35aa8
parent010272a796325d3b9a94b5dcf887706cd2524b27 (diff)
v4l2object: Don't share own pool if min exceed V4L2 capacity
If the minimum required buffer exceed V4L2 capacity, don't share down pool. This allow support very high latency, like with x264enc default encoding settings. https://bugzilla.gnome.org/show_bug.cgi?id=732288
-rw-r--r--sys/v4l2/gstv4l2object.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index f8a6c4dc2..180313323 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -3183,6 +3183,20 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
can_share_own_pool = (has_video_meta || !obj->need_video_meta);
+ /* Certain driver may expose a minimum through controls */
+ ctl.id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE;
+ if (v4l2_ioctl (obj->video_fd, VIDIOC_G_CTRL, &ctl) >= 0) {
+ GST_DEBUG_OBJECT (obj->element, "driver require a minimum of %d buffers",
+ ctl.value);
+ obj->min_buffers_for_capture = ctl.value;
+ } else {
+ obj->min_buffers_for_capture = 0;
+ }
+
+ /* We can't share our own pool, if it exceed V4L2 capacity */
+ if (min + obj->min_buffers_for_capture + 1 > VIDEO_MAX_FRAME)
+ can_share_own_pool = FALSE;
+
/* select a pool */
switch (obj->mode) {
case GST_V4L2_IO_RW:
@@ -3250,16 +3264,6 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
if (size == 0)
goto no_size;
- /* Certain driver may expose a minimum through controls */
- ctl.id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE;
- if (v4l2_ioctl (obj->video_fd, VIDIOC_G_CTRL, &ctl) >= 0) {
- GST_DEBUG_OBJECT (obj->element, "driver require a minimum of %d buffers",
- ctl.value);
- obj->min_buffers_for_capture = ctl.value;
- } else {
- obj->min_buffers_for_capture = 0;
- }
-
/* If pushing from our own pool, configure it with queried minimum,
* otherwise use the minimum required */
if (pushing_from_our_pool) {