diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 14b11695..dff7f0bf 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -556,12 +556,17 @@ static void mpp_dec_put_frame(Mpp *mpp, RK_S32 index, HalDecTaskFlag flags) do { ret = hal_task_get_hnd(group, TASK_IDLE, &hnd); if (ret) { - msleep(10); + if (dec->reset_flag) { + MppBuffer buffer = NULL; + mpp_buf_slot_get_prop(slots, index, SLOT_BUFFER, &buffer); + if (buffer) + mpp_buffer_put(buffer); + return; + } else { + msleep(10); + } } } while (ret); - - mpp_assert(ret == MPP_OK); - vproc_task->flags.val = 0; vproc_task->flags.eos = eos; vproc_task->input = index; @@ -632,7 +637,15 @@ static void mpp_dec_put_frame(Mpp *mpp, RK_S32 index, HalDecTaskFlag flags) do { ret = hal_task_get_hnd(group, TASK_IDLE, &hnd); if (ret) { - msleep(10); + if (dec->reset_flag) { + MppBuffer buffer = NULL; + mpp_buf_slot_get_prop(slots, index, SLOT_BUFFER, &buffer); + if (buffer) + mpp_buffer_put(buffer); + return; + } else { + msleep(10); + } } } while (ret); @@ -2050,6 +2063,9 @@ MPP_RET mpp_dec_notify(MppDec ctx, RK_U32 flag) notify = 1; } + if (dec->vproc && (flag & MPP_DEC_NOTIFY_BUFFER_MATCH)) + dec_vproc_signal(dec->vproc); + if (notify) { dec_dbg_notify("%p status %08x notify control signal\n", dec, dec->parser_wait_flag, dec->parser_notify_flag); diff --git a/mpp/vproc/mpp_dec_vproc.cpp b/mpp/vproc/mpp_dec_vproc.cpp index a3ea4d38..330cc019 100644 --- a/mpp/vproc/mpp_dec_vproc.cpp +++ b/mpp/vproc/mpp_dec_vproc.cpp @@ -559,6 +559,22 @@ static void dec_vproc_update_ref(MppDecVprocCtxImpl *ctx, MppFrame frm, RK_U32 i return; } +static void dev_vproc_reset(MppThread *thd, MppDecVprocCtxImpl *ctx) +{ + AutoMutex autolock_reset(thd->mutex(THREAD_CONTROL)); + + if (ctx->reset) { + vproc_dbg_reset("reset start\n"); + dec_vproc_clr_prev(ctx); + + ctx->reset = 0; + sem_post(&ctx->reset_sem); + ctx->task_status.val = 0; + ctx->task_wait.val = 0; + vproc_dbg_reset("reset done\n"); + } +} + static void *dec_vproc_thread(void *data) { MppDecVprocCtxImpl *ctx = (MppDecVprocCtxImpl *)data; @@ -584,17 +600,8 @@ static void *dec_vproc_thread(void *data) break; if (ctx->task_wait.task_in) { - AutoMutex autolock_reset(thd->mutex(THREAD_CONTROL)); if (ctx->reset) { - vproc_dbg_reset("reset start\n"); - dec_vproc_clr_prev(ctx); - - ctx->reset = 0; - sem_post(&ctx->reset_sem); - ctx->task_status.val = 0; - ctx->task_wait.val = 0; - vproc_dbg_reset("reset done\n"); - continue; + goto RESET; } } @@ -688,6 +695,8 @@ static void *dec_vproc_thread(void *data) vproc_dbg_status("vproc task done"); } + RESET: + dev_vproc_reset(thd, ctx); } mpp_dbg_info("mpp_dec_post_proc_thread exited\n");