From de864932e38ae9df758d1f987d0fb0b527be97cc Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Wed, 11 May 2022 15:19:58 +0800 Subject: [PATCH] [h265d]: Fix error of reset on info change Change-Id: I31c5e7a0888da0ff0e7363929d0bd45369149178 Signed-off-by: sayon.chen Signed-off-by: Herman Chen --- mpp/codec/dec/h265/h265d_parser.c | 8 +++++--- mpp/codec/mpp_dec.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mpp/codec/dec/h265/h265d_parser.c b/mpp/codec/dec/h265/h265d_parser.c index 5315b3d0..4d7c0edd 100644 --- a/mpp/codec/dec/h265/h265d_parser.c +++ b/mpp/codec/dec/h265/h265d_parser.c @@ -1872,8 +1872,6 @@ MPP_RET h265d_parse(void *ctx, HalDecTask *task) h265d_dbg(H265D_DBG_GLOBAL, "decode poc = %d", s->poc); if (s->ref) { h265d_parser2_syntax(h265dctx); - if (!task->flags.parse_err) - s->ps_need_upate = 0; s->task->syntax.data = s->hal_pic_private; s->task->syntax.number = 1; @@ -2097,9 +2095,9 @@ MPP_RET h265d_callback(void *ctx, void *err_info) { H265dContext_t *h265dctx = (H265dContext_t *)ctx; HalDecTask *task_dec = (HalDecTask *)err_info; + HEVCContext *s = (HEVCContext *)h265dctx->priv_data; if (!h265dctx->cfg->base.disable_error) { - HEVCContext *s = (HEVCContext *)h265dctx->priv_data; MppFrame frame = NULL; RK_U32 i = 0; @@ -2116,6 +2114,10 @@ MPP_RET h265d_callback(void *ctx, void *err_info) } } } + + if (!task_dec->flags.parse_err) + s->ps_need_upate = 0; + (void) err_info; return MPP_OK; diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 4306ff6d..cfea6df7 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -300,15 +300,11 @@ static RK_U32 reset_parser_thread(Mpp *mpp, DecTask *task) dec_dbg_reset("reset: vproc reset done\n"); } - // wait hal thread reset ready - if (task->wait.info_change) { - mpp_log("reset at info change status\n"); - mpp_buf_slot_reset(frame_slots, task_dec->output); - } - if (task->status.task_parsed_rdy) { mpp_log("task no send to hal que must clr current frame hal status\n"); - mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT); + if (task_dec->output >= 0) + mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT); + for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) { index = task_dec->refer[i]; if (index >= 0) @@ -346,6 +342,10 @@ static RK_U32 reset_parser_thread(Mpp *mpp, DecTask *task) task_dec->input = -1; } + // wait hal thread reset ready + if (task->wait.info_change) + mpp_log("reset at info change\n"); + task->status.task_parsed_rdy = 0; // IMPORTANT: clear flag in MppDec context dec->parser_status_flag = 0;