Commit 010272a7 authored by Aurélien Zanelli's avatar Aurélien Zanelli Committed by Nicolas Dufresne

v4l2object: query minimum required buffers for output

Some v4l2 devices could require a minimum buffers different from default
values. Rather than blindly propose a pool with min-buffers set to the
default value, it ask the device using control ioctl.

https://bugzilla.gnome.org/show_bug.cgi?id=733750
parent de799f4d
......@@ -3412,6 +3412,7 @@ gst_v4l2_object_propose_allocation (GstV4l2Object * obj, GstQuery * query)
guint size, min, max;
GstCaps *caps;
gboolean need_pool;
struct v4l2_control ctl = { 0, };
/* Set defaults allocation parameters */
size = obj->info.size;
......@@ -3444,6 +3445,15 @@ gst_v4l2_object_propose_allocation (GstV4l2Object * obj, GstQuery * query)
gst_structure_free (config);
}
/* Some devices may expose a minimum */
ctl.id = V4L2_CID_MIN_BUFFERS_FOR_OUTPUT;
if (v4l2_ioctl (obj->video_fd, VIDIOC_G_CTRL, &ctl) >= 0) {
GST_DEBUG_OBJECT (obj->element, "driver require a miminum of %d buffers",
ctl.value);
min = MAX (ctl.value, GST_V4L2_MIN_BUFFERS);
}
gst_query_add_allocation_pool (query, pool, size, min, max);
/* we also support various metadata */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment