From e6a8718f0c5b46ddb2c628229c8df10691cbb6fb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 25 Jul 2011 15:38:38 +0200 Subject: [PATCH] v4l2: fix flushing start and stop Move the flushing calls to the right place in the bufferpool. Fix the min and max buffer sizes. --- sys/v4l2/gstv4l2bufferpool.c | 8 ++++++-- sys/v4l2/gstv4l2object.c | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 8d1f8fc..e7ace31 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -240,8 +240,8 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config) GST_DEBUG_OBJECT (pool, "config %" GST_PTR_FORMAT, config); pool->size = size; - pool->min_buffers = min_buffers; - pool->max_buffers = max_buffers; + pool->max_buffers = MAX (min_buffers, max_buffers); + pool->min_buffers = MIN (pool->max_buffers, min_buffers); pool->prefix = prefix; pool->align = align; @@ -360,6 +360,8 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool) if (!start_streaming (pool)) goto start_failed; + gst_poll_set_flushing (obj->poll, FALSE); + return TRUE; /* ERRORS */ @@ -398,6 +400,8 @@ gst_v4l2_buffer_pool_stop (GstBufferPool * bpool) GST_DEBUG_OBJECT (pool, "stopping pool"); + gst_poll_set_flushing (obj->poll, TRUE); + if (pool->streaming) { switch (obj->mode) { case GST_V4L2_IO_RW: diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index a5edc4e..836e582 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2418,8 +2418,6 @@ gst_v4l2_object_stop (GstV4l2Object * v4l2object) if (!GST_V4L2_IS_ACTIVE (v4l2object)) goto done; - gst_poll_set_flushing (v4l2object->poll, TRUE); - if (v4l2object->pool) { GST_DEBUG_OBJECT (v4l2object->element, "deactivating pool"); gst_buffer_pool_set_active (v4l2object->pool, FALSE); -- 2.7.4