[legacy]: fix possible error release frame before display it.

This will cause error buffer to be displayed.

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@696 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2016-05-07 07:55:14 +00:00
parent 4fbb511549
commit e51e860b65

View File

@@ -238,7 +238,7 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
mpp_log("[write_out_yuv] FrameWidth = %d, FrameHeight = %d", img_w, img_h); mpp_log("[write_out_yuv] FrameWidth = %d, FrameHeight = %d", img_w, img_h);
} }
} else { } else {
fwrite(ptr, 1, vframe->FrameWidth * vframe->FrameHeight * 3 / 2, fp); fwrite(ptr, 1, vframe->FrameWidth * vframe->FrameHeight * 3 / 2, fp);
if (vpu_api_debug & VPU_API_DBG_DUMP_LOG) { if (vpu_api_debug & VPU_API_DBG_DUMP_LOG) {
mpp_log("[write_out_yuv] FrameWidth = %d, FrameHeight = %d", vframe->FrameWidth, vframe->FrameHeight); mpp_log("[write_out_yuv] FrameWidth = %d, FrameHeight = %d", vframe->FrameWidth, vframe->FrameHeight);
} }
@@ -259,7 +259,15 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
aDecOut->size = 0; aDecOut->size = 0;
} }
} }
mpp_free(mframe);
/*
* IMPORTANT: mframe is malloced frome mpi->decode_get_frame
* So we need to deinit mframe here. But the buffer in the frame should not be free with mframe.
* Because buffer need to be set to vframe->vpumem.offset and send to display.
* The we have to clear the buffer pointer in mframe then release mframe.
*/
mpp_frame_set_buffer(mframe, NULL);
mpp_frame_deinit(&mframe);
} else { } else {
aDecOut->size = 0; aDecOut->size = 0;
} }