[mpp]: cancel release mpp_frame in put_frame api

NOTE: This change may effect some existed program.
MPP caller should always follow the rule that the resouce creator must
be the resource destoryer. So caller of encode_put_frame should release
the input MppFrame structure and MPP should not release the input frame.

Change-Id: I36897dbbf1697002ae64868f2385961472eeb7c5
Signed-off-by: Francis Fan <francis.fan@rock-chips.com>
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Francis Fan
2020-03-20 10:48:40 +08:00
committed by Herman Chen
parent 6a76bfc3f5
commit d4cae78524
3 changed files with 12 additions and 9 deletions

View File

@@ -1269,7 +1269,10 @@ PUT_FRAME:
mpp_err_f("encode_put_frame ret %d\n", ret); mpp_err_f("encode_put_frame ret %d\n", ret);
else else
aEncInStrm->size = 0; aEncInStrm->size = 0;
FUNC_RET: FUNC_RET:
if (frame)
mpp_frame_deinit(&frame);
vpu_api_dbg_func("leave ret %d\n", ret); vpu_api_dbg_func("leave ret %d\n", ret);
return ret; return ret;

View File

@@ -426,15 +426,6 @@ MPP_RET Mpp::put_frame(MppFrame frame)
mpp_assert(mInputTask); 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: RET:
return ret; return ret;
} }

View File

@@ -415,11 +415,20 @@ MPP_RET test_mpp_run(MpiEncTestData *p)
else else
mpp_frame_set_buffer(frame, p->frm_buf); 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); ret = mpi->encode_put_frame(ctx, frame);
if (ret) { if (ret) {
mpp_err("mpp encode put frame failed\n"); mpp_err("mpp encode put frame failed\n");
mpp_frame_deinit(&frame);
goto RET; goto RET;
} }
mpp_frame_deinit(&frame);
ret = mpi->encode_get_packet(ctx, &packet); ret = mpi->encode_get_packet(ctx, &packet);
if (ret) { if (ret) {