summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-12-07 17:27:37 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-12-07 17:42:48 -0500
commit0e05faf91a476efd56adfb0d1b82e71a2d13ff89 (patch)
tree0e15d0ccf1e9ace6ae2a5aedaba418d7e0652247
parentd328eea5f20884bd58315fc7299be5e6df0b9f71 (diff)
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
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index 55d3a102f..f9010514e 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -473,7 +473,8 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
can_allocate = GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, DMABUF);
break;
case GST_V4L2_IO_RW:
- pool->allocator = g_object_ref (allocator);
+ if (allocator)
+ pool->allocator = g_object_ref (allocator);
pool->params = params;
/* No need to change the configuration */
goto done;
@@ -741,7 +742,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
pool->min_latency = min_latency;
pool->num_queued = 0;
- if (max_buffers < min_buffers)
+ if (max_buffers != 0 && max_buffers < min_buffers)
max_buffers = 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;
- GST_OBJECT_LOCK (pool);
- while (pool->empty)
- g_cond_wait (&pool->empty_cond, GST_OBJECT_GET_LOCK (pool));
- GST_OBJECT_UNLOCK (pool);
+ /* In RW mode there is no queue, hence no need to wait while the queue is
+ * empty */
+ if (pool->obj->mode != GST_V4L2_IO_RW) {
+ 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)
goto done;