Commit 0d852cf2 authored by Benjamin Gaignard's avatar Benjamin Gaignard Committed by Nicolas Dufresne

v4l2bufferpool: Update pool limit with hardware requiremenst

If the driver need more buffers than requested by the config,
update the pool min/max values. The minimum value for the pool
could be provided either by the driver or by the pool. This is
best effort for drivers that don't support
CID V4L2_CID_MIN_BUFFERS_FOR_CAPTURE.

https://bugzilla.gnome.org/show_bug.cgi?id=730200
parent 541a9670
......@@ -668,9 +668,9 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
copy_threshold =
MAX (GST_V4L2_MIN_BUFFERS, obj->min_buffers_for_capture);
/* Ensure GstBufferPool don't expect initial minimum */
if (min_buffers > count)
min_buffers = count;
/* The initial minimum could be provide either by GstBufferPool or
* driver needs. */
min_buffers = count;
}
break;
......@@ -696,7 +696,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
goto no_buffers;
}
num_buffers = count;
min_buffers = num_buffers = count;
break;
}
case GST_V4L2_IO_DMABUF_IMPORT:
......@@ -720,7 +720,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
goto no_buffers;
}
num_buffers = count;
min_buffers = num_buffers = count;
break;
}
default:
......@@ -735,6 +735,9 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
pool->num_buffers = num_buffers;
pool->num_queued = 0;
if (max_buffers < min_buffers)
max_buffers = min_buffers;
gst_buffer_pool_config_set_params (config, caps, size, min_buffers,
max_buffers);
GST_BUFFER_POOL_CLASS (parent_class)->set_config (bpool, config);
......
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