mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
v4l2: Fix RW io mode
In RW, allocator can be null, max_buffers can be zero, and we need not to wait while the queue is empty since there is no queue. https://bugzilla.gnome.org/show_bug.cgi?id=740633
This commit is contained in:
parent
d328eea5f2
commit
0e05faf91a
1 changed files with 11 additions and 6 deletions
|
@ -473,7 +473,8 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
||||||
can_allocate = GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, DMABUF);
|
can_allocate = GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, DMABUF);
|
||||||
break;
|
break;
|
||||||
case GST_V4L2_IO_RW:
|
case GST_V4L2_IO_RW:
|
||||||
pool->allocator = g_object_ref (allocator);
|
if (allocator)
|
||||||
|
pool->allocator = g_object_ref (allocator);
|
||||||
pool->params = params;
|
pool->params = params;
|
||||||
/* No need to change the configuration */
|
/* No need to change the configuration */
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -741,7 +742,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
|
||||||
pool->min_latency = min_latency;
|
pool->min_latency = min_latency;
|
||||||
pool->num_queued = 0;
|
pool->num_queued = 0;
|
||||||
|
|
||||||
if (max_buffers < min_buffers)
|
if (max_buffers != 0 && max_buffers < min_buffers)
|
||||||
max_buffers = min_buffers;
|
max_buffers = min_buffers;
|
||||||
|
|
||||||
gst_buffer_pool_config_set_params (config, caps, size, min_buffers,
|
gst_buffer_pool_config_set_params (config, caps, size, min_buffers,
|
||||||
|
@ -957,10 +958,14 @@ gst_v4l2_buffer_pool_poll (GstV4l2BufferPool * pool)
|
||||||
{
|
{
|
||||||
gint ret;
|
gint ret;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (pool);
|
/* In RW mode there is no queue, hence no need to wait while the queue is
|
||||||
while (pool->empty)
|
* empty */
|
||||||
g_cond_wait (&pool->empty_cond, GST_OBJECT_GET_LOCK (pool));
|
if (pool->obj->mode != GST_V4L2_IO_RW) {
|
||||||
GST_OBJECT_UNLOCK (pool);
|
GST_OBJECT_LOCK (pool);
|
||||||
|
while (pool->empty)
|
||||||
|
g_cond_wait (&pool->empty_cond, GST_OBJECT_GET_LOCK (pool));
|
||||||
|
GST_OBJECT_UNLOCK (pool);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pool->can_poll_device)
|
if (!pool->can_poll_device)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in a new issue