aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/videobuf2-core.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-02-25 07:42:45 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-11 05:56:43 -0400
commit3f1a9a33a58eebcc5799d9a6b797e9e19cf8627f (patch)
treed3e1e5706880abb7a71e69c892d01c3b4bec7140 /drivers/media/v4l2-core/videobuf2-core.c
parente4d2581649fe87bbd506c4d55591c4de9d2962d8 (diff)
[media] vb2: fix streamoff handling if streamon wasn't called
If you request buffers, then queue buffers and then call STREAMOFF those buffers are not returned to their dequeued state because streamoff will just return if q->streaming was 0. This means that afterwards you can never QBUF that same buffer again unless you do STREAMON, REQBUFS or close the filehandle first. It is clear that if you do STREAMOFF even if no STREAMON was called before, you still want to have all buffers returned to their proper dequeued state. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/videobuf2-core.c')
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index f8fe1d9c7b4f..d853cd47c86a 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -2125,14 +2125,14 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
2125 return -EINVAL; 2125 return -EINVAL;
2126 } 2126 }
2127 2127
2128 if (!q->streaming) {
2129 dprintk(3, "streamoff successful: not streaming\n");
2130 return 0;
2131 }
2132
2133 /* 2128 /*
2134 * Cancel will pause streaming and remove all buffers from the driver 2129 * Cancel will pause streaming and remove all buffers from the driver
2135 * and videobuf, effectively returning control over them to userspace. 2130 * and videobuf, effectively returning control over them to userspace.
2131 *
2132 * Note that we do this even if q->streaming == 0: if you prepare or
2133 * queue buffers, and then call streamoff without ever having called
2134 * streamon, you would still expect those buffers to be returned to
2135 * their normal dequeued state.
2136 */ 2136 */
2137 __vb2_queue_cancel(q); 2137 __vb2_queue_cancel(q);
2138 2138