diff --git a/mpp/legacy/vpu_api_legacy.cpp b/mpp/legacy/vpu_api_legacy.cpp index f7f4300d..d0ed621a 100644 --- a/mpp/legacy/vpu_api_legacy.cpp +++ b/mpp/legacy/vpu_api_legacy.cpp @@ -1269,7 +1269,10 @@ PUT_FRAME: mpp_err_f("encode_put_frame ret %d\n", ret); else aEncInStrm->size = 0; + FUNC_RET: + if (frame) + mpp_frame_deinit(&frame); vpu_api_dbg_func("leave ret %d\n", ret); return ret; diff --git a/mpp/mpp.cpp b/mpp/mpp.cpp index 944828b2..65395a09 100644 --- a/mpp/mpp.cpp +++ b/mpp/mpp.cpp @@ -426,15 +426,6 @@ MPP_RET Mpp::put_frame(MppFrame frame) mpp_assert(mInputTask); - /* clear the enqueued task back */ - if (mInputTask) { - ret = mpp_task_meta_get_frame(mInputTask, KEY_INPUT_FRAME, &frame); - if (frame) { - mpp_frame_deinit(&frame); - frame = NULL; - } - } - RET: return ret; } diff --git a/test/mpi_enc_test.c b/test/mpi_enc_test.c index 5d6ebe55..a4efe4fa 100644 --- a/test/mpi_enc_test.c +++ b/test/mpi_enc_test.c @@ -415,11 +415,20 @@ MPP_RET test_mpp_run(MpiEncTestData *p) else mpp_frame_set_buffer(frame, p->frm_buf); + /* + * NOTE: in non-block mode the frame can be resent. + * The default input timeout mode is block. + * + * User should release the input frame to meet the requirements of + * resource creator must be the resource destroyer. + */ ret = mpi->encode_put_frame(ctx, frame); if (ret) { mpp_err("mpp encode put frame failed\n"); + mpp_frame_deinit(&frame); goto RET; } + mpp_frame_deinit(&frame); ret = mpi->encode_get_packet(ctx, &packet); if (ret) {