Commit a02f6ca3 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab
Browse files

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: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 1b438b45
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1098,6 +1098,7 @@ static int coda_decoder_cmd(struct file *file, void *fh,
			/* Mark last buffer */
			buf->flags |= V4L2_BUF_FLAG_LAST;

		if (v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) == 0) {
			/* Set the stream-end flag on this context */
			coda_bit_stream_end_flag(ctx);
			ctx->hold = false;
@@ -1106,8 +1107,11 @@ static int coda_decoder_cmd(struct file *file, void *fh,
			flush_work(&ctx->pic_run_work);

			/* If there is no buffer in flight, wake up */
		if (!ctx->streamon_out || ctx->qsequence == ctx->osequence)
			if (!ctx->streamon_out ||
			    ctx->qsequence == ctx->osequence)
				coda_wake_up_capture_queue(ctx);
		}

		break;
	default:
		return -EINVAL;