From b98bc75f474e864f7ccecfafc123656b073cc7fb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 19 Jul 2011 18:25:29 +0100 Subject: [PATCH] v4l2: only to STREAMOFF when streaming Only call STREAMOFF when we previously called STREAMON --- sys/v4l2/gstv4l2bufferpool.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index c5b06130e4..72940c888f 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -398,24 +398,25 @@ gst_v4l2_buffer_pool_stop (GstBufferPool * bpool) GST_DEBUG_OBJECT (pool, "stopping pool"); - switch (obj->mode) { - case GST_V4L2_IO_RW: - break; - case GST_V4L2_IO_MMAP: - case GST_V4L2_IO_USERPTR: - /* we actually need to sync on all queued buffers but not - * on the non-queued ones */ - GST_DEBUG_OBJECT (pool, "STREAMOFF"); - if (v4l2_ioctl (pool->video_fd, VIDIOC_STREAMOFF, &obj->type) < 0) - goto stop_failed; - break; - default: - g_assert_not_reached (); - break; + if (pool->streaming) { + switch (obj->mode) { + case GST_V4L2_IO_RW: + break; + case GST_V4L2_IO_MMAP: + case GST_V4L2_IO_USERPTR: + /* we actually need to sync on all queued buffers but not + * on the non-queued ones */ + GST_DEBUG_OBJECT (pool, "STREAMOFF"); + if (v4l2_ioctl (pool->video_fd, VIDIOC_STREAMOFF, &obj->type) < 0) + goto stop_failed; + break; + default: + g_assert_not_reached (); + break; + } + pool->streaming = FALSE; } - pool->streaming = FALSE; - /* first free the buffers in the queue */ ret = GST_BUFFER_POOL_CLASS (parent_class)->stop (bpool);