v4l2: fix flushing start and stop
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 25 Jul 2011 13:38:38 +0000 (15:38 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 25 Jul 2011 13:39:18 +0000 (15:39 +0200)
Move the flushing calls to the right place in the bufferpool.
Fix the min and max buffer sizes.

sys/v4l2/gstv4l2bufferpool.c
sys/v4l2/gstv4l2object.c

index 8d1f8fc..e7ace31 100644 (file)
@@ -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:
index a5edc4e..836e582 100644 (file)
@@ -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);