Commit 2b7eea83 authored by Florian Echtler's avatar Florian Echtler Committed by Mauro Carvalho Chehab

[media] return BUF_STATE_ERROR if streaming stopped during acquisition

When stop_streaming is called while a frame is currently being retrieved, the
buffer being filled will still be returned with BUF_STATE_DONE. By resetting
the sequence number and checking before returning the buffer, it can now
correctly be returned with BUF_STATE_ERROR.
Signed-off-by: default avatarMartin Kaltenbrunner <modin@yuri.at>
Signed-off-by: default avatarFlorian Echtler <floe@butterbrot.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 0cfdfcc1
...@@ -438,6 +438,10 @@ static void sur40_process_video(struct sur40_state *sur40) ...@@ -438,6 +438,10 @@ static void sur40_process_video(struct sur40_state *sur40)
dev_dbg(sur40->dev, "image acquired\n"); dev_dbg(sur40->dev, "image acquired\n");
/* return error if streaming was stopped in the meantime */
if (sur40->sequence == -1)
goto err_poll;
/* mark as finished */ /* mark as finished */
v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp); v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp);
new_buf->vb.v4l2_buf.sequence = sur40->sequence++; new_buf->vb.v4l2_buf.sequence = sur40->sequence++;
...@@ -723,6 +727,7 @@ static int sur40_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -723,6 +727,7 @@ static int sur40_start_streaming(struct vb2_queue *vq, unsigned int count)
static void sur40_stop_streaming(struct vb2_queue *vq) static void sur40_stop_streaming(struct vb2_queue *vq)
{ {
struct sur40_state *sur40 = vb2_get_drv_priv(vq); struct sur40_state *sur40 = vb2_get_drv_priv(vq);
sur40->sequence = -1;
/* Release all active buffers */ /* Release all active buffers */
return_all_buffers(sur40, VB2_BUF_STATE_ERROR); return_all_buffers(sur40, VB2_BUF_STATE_ERROR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment