[PATCH 1/5] media: mtk-vcodec: enter ABORT state if encoding failed

From: Dafna Hirschfeld
Date: Wed Aug 04 2021 - 10:33:06 EST


In case the encoding failed, we should set
ctx->state = MTK_STATE_ABORT, since this indicates
a fatal error and there is no point to continue
trying to encode in that case.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@xxxxxxxxxxxxx>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 416f356af363..1678c31bc9aa 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -1109,6 +1109,7 @@ static void mtk_venc_worker(struct work_struct *work)
dst_buf->vb2_buf.planes[0].bytesused = 0;
v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR);
mtk_v4l2_err("venc_if_encode failed=%d", ret);
+ ctx->state = MTK_STATE_ABORT;
} else {
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
dst_buf->vb2_buf.planes[0].bytesused = enc_result.bs_size;
--
2.17.1