Skip to content

Commit

Permalink
[media] coda: don't start streaming without queued buffers
Browse files Browse the repository at this point in the history
We could support start streaming with an empty output queue for the
BIT decoders due to the bitstream buffer which could still contain
data at this point, but there is really no reason for userspace to
expect this to work. Simplify the code by disallowing it.

Signed-off-by: Philipp Zabel <[email protected]>
Signed-off-by: Kamil Debski <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
pH5 authored and mchehab committed Dec 23, 2015
1 parent bb757d7 commit 49b966f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions drivers/media/platform/coda/coda-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,9 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
struct vb2_v4l2_buffer *buf;
int ret = 0;

if (count < 1)
return -EINVAL;

q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
if (ctx->inst_type == CODA_INST_DECODER && ctx->use_bit) {
Expand All @@ -1264,20 +1267,10 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
ret = -EINVAL;
goto err;
}
} else {
if (count < 1) {
ret = -EINVAL;
goto err;
}
}

ctx->streamon_out = 1;
} else {
if (count < 1) {
ret = -EINVAL;
goto err;
}

ctx->streamon_cap = 1;
}

Expand Down

0 comments on commit 49b966f

Please sign in to comment.