mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 23:14:46 +00:00
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
This commit is contained in:
parent
de799f4d84
commit
010272a796
1 changed files with 10 additions and 0 deletions
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue