media: vicodec: reset last_src/dst_buf based on the IS_OUTPUT

When start_streaming was called both last_src_buf and last_dst_buf
pointers were set to NULL, but this depends on whether the capture
or output queue starts streaming.

When decoding with resolution changes in between the capture queue
has to restart streaming whenever a resolution change occurs. And
that would reset last_src_buf as well, which causes a problem if
the decoder was stopped by the application. Since last_src_buf
is now NULL, the LAST flag is never set for the last capture
buffer.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Hans Verkuil 2019-03-13 10:47:13 -04:00 committed by Mauro Carvalho Chehab
parent f221b84ee1
commit 76eb24fc23
1 changed files with 5 additions and 2 deletions

View File

@ -1337,8 +1337,11 @@ static int vicodec_start_streaming(struct vb2_queue *q,
chroma_div = info->width_div * info->height_div;
q_data->sequence = 0;
if (V4L2_TYPE_IS_OUTPUT(q->type))
ctx->last_src_buf = NULL;
else
ctx->last_dst_buf = NULL;
state->gop_cnt = 0;
if ((V4L2_TYPE_IS_OUTPUT(q->type) && !ctx->is_enc) ||