From fdc8ef19cbc64cd0f62fbd150879d03456a941c1 Mon Sep 17 00:00:00 2001 From: Chen Jinsen Date: Thu, 7 Nov 2019 11:57:23 +0800 Subject: [PATCH] [mpp]: Fix output slot index assertion failure while get parse error Change-Id: I06a9897bad7edbcd96b171faaecdab38a08d46eb Signed-off-by: Chen Jinsen --- mpp/codec/dec/h264/h264d_api.c | 4 +++- mpp/codec/mpp_dec.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mpp/codec/dec/h264/h264d_api.c b/mpp/codec/dec/h264/h264d_api.c index 77f31368..37e52e4b 100644 --- a/mpp/codec/dec/h264/h264d_api.c +++ b/mpp/codec/dec/h264/h264d_api.c @@ -644,7 +644,9 @@ MPP_RET h264d_callback(void *decoder, void *errinfo) RK_U32 *p_regs = ctx->regs; HalDecTask *task_dec = (HalDecTask *)ctx->task; - mpp_buf_slot_get_prop(p_Dec->frame_slots, task_dec->output, SLOT_FRAME_PTR, &mframe); + if (task_dec->output >= 0) + mpp_buf_slot_get_prop(p_Dec->frame_slots, task_dec->output, SLOT_FRAME_PTR, &mframe); + if (mframe) { RK_U32 task_err = task_dec->flags.parse_err || task_dec->flags.ref_err; if (ctx->hard_err || task_err) { diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index a4d72f4e..76ae98db 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -997,7 +997,9 @@ void *mpp_dec_hal_thread(void *data) task = NULL; - 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++) { RK_S32 index = task_dec->refer[i]; if (index >= 0)