diff --git a/mpp/codec/mpp_buf_slot.cpp b/mpp/codec/mpp_buf_slot.cpp index 701b12b6..c6bb3d1f 100644 --- a/mpp/codec/mpp_buf_slot.cpp +++ b/mpp/codec/mpp_buf_slot.cpp @@ -562,7 +562,7 @@ MPP_RET mpp_buf_slot_set_flag(MppBufSlots slots, RK_S32 index, SlotUsageType typ MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); + slot_assert(impl, (index >= 0) && (index < impl->count)); slot_ops_with_log(impl, &impl->slots[index], set_flag_op[type]); return MPP_OK; } @@ -576,7 +576,7 @@ MPP_RET mpp_buf_slot_clr_flag(MppBufSlots slots, RK_S32 index, SlotUsageType typ MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); + slot_assert(impl, (index >= 0) && (index < impl->count)); MppBufSlotEntry *slot = &impl->slots[index]; slot_ops_with_log(impl, slot, clr_flag_op[type]); @@ -596,7 +596,7 @@ MPP_RET mpp_buf_slot_enqueue(MppBufSlots slots, RK_S32 index, SlotQueueType type MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); + slot_assert(impl, (index >= 0) && (index < impl->count)); MppBufSlotEntry *slot = &impl->slots[index]; slot_ops_with_log(impl, slot, SLOT_ENQUEUE); @@ -641,7 +641,7 @@ MPP_RET mpp_buf_slot_set_prop(MppBufSlots slots, RK_S32 index, SlotPropType type MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); + slot_assert(impl, (index >= 0) && (index < impl->count)); MppBufSlotEntry *slot = &impl->slots[index]; slot_ops_with_log(impl, slot, set_val_op[type]); @@ -687,7 +687,7 @@ MPP_RET mpp_buf_slot_get_prop(MppBufSlots slots, RK_S32 index, SlotPropType type MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); + slot_assert(impl, (index >= 0) && (index < impl->count)); MppBufSlotEntry *slot = &impl->slots[index]; switch (type) { diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 4283b2c6..13982624 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -267,10 +267,10 @@ void *mpp_dec_parser_thread(void *data) prev_task_done = 0; hal_task_info_init(&task_local, MPP_CTX_DEC); } - if (NULL != task) { + + if (NULL != task && task_dec->valid) { mpp_buf_slot_set_flag(packet_slots, task_dec->input, SLOT_CODEC_READY); mpp_buf_slot_set_flag(packet_slots, task_dec->input, SLOT_HAL_INPUT); - mpp_buf_slot_get_prop(packet_slots, task_dec->input, SLOT_BUFFER, &buffer); mpp_buf_slot_clr_flag(packet_slots, task_dec->input, SLOT_HAL_INPUT); if (buffer) mpp_buffer_put(buffer);