media: coda: only set the stream end flags if there are no more pending output buffers

If there are still queued output buffers pending to be copied into the
bitstream ring buffer, setting the stream end flag should be deferred
until the marked last output buffer is written into the bitstream ring
buffer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Philipp Zabel 2019-06-18 12:45:25 -04:00 committed by Mauro Carvalho Chehab
parent 1b438b4540
commit a02f6ca336

View File

@ -1098,16 +1098,20 @@ static int coda_decoder_cmd(struct file *file, void *fh,
/* Mark last buffer */ /* Mark last buffer */
buf->flags |= V4L2_BUF_FLAG_LAST; buf->flags |= V4L2_BUF_FLAG_LAST;
/* Set the stream-end flag on this context */ if (v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) == 0) {
coda_bit_stream_end_flag(ctx); /* Set the stream-end flag on this context */
ctx->hold = false; coda_bit_stream_end_flag(ctx);
v4l2_m2m_try_schedule(ctx->fh.m2m_ctx); ctx->hold = false;
v4l2_m2m_try_schedule(ctx->fh.m2m_ctx);
flush_work(&ctx->pic_run_work); flush_work(&ctx->pic_run_work);
/* If there is no buffer in flight, wake up */
if (!ctx->streamon_out ||
ctx->qsequence == ctx->osequence)
coda_wake_up_capture_queue(ctx);
}
/* If there is no buffer in flight, wake up */
if (!ctx->streamon_out || ctx->qsequence == ctx->osequence)
coda_wake_up_capture_queue(ctx);
break; break;
default: default:
return -EINVAL; return -EINVAL;