[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

@@ -27,7 +27,7 @@
#define VPU_API_DBG_OUTPUT (0x00000001) #define VPU_API_DBG_OUTPUT (0x00000001)
#define VPU_API_DBG_DUMP_YUV (0x00000002) #define VPU_API_DBG_DUMP_YUV (0x00000002)
#define VPU_API_DBG_DUMP_LOG (0x00000004) #define VPU_API_DBG_DUMP_LOG (0x00000004)
#define MAX_WRITE_HEIGHT (480) #define MAX_WRITE_HEIGHT (480)
#define MAX_WRITE_WIDTH (960) #define MAX_WRITE_WIDTH (960)
VpuApi::VpuApi() VpuApi::VpuApi()
@@ -194,7 +194,7 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
vframe->ColorType = VPU_OUTPUT_FORMAT_YUV422; vframe->ColorType = VPU_OUTPUT_FORMAT_YUV422;
vframe->ColorType |= VPU_OUTPUT_FORMAT_BIT_10; vframe->ColorType |= VPU_OUTPUT_FORMAT_BIT_10;
break; break;
} }
default: default:
break; break;
} }
@@ -219,7 +219,7 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
for (i = 0; i < img_h; i++) { for (i = 0; i < img_h; i++) {
for (j = 0; j < img_w; j++) { for (j = 0; j < img_w; j++) {
pdes[j] = psrc[j * step]; pdes[j] = psrc[j * step];
} }
pdes += img_w; pdes += img_w;
psrc += step * vframe->FrameWidth; psrc += step * vframe->FrameWidth;
} }
@@ -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;
} }