Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6742 Discussions

A minior bug in UMC::H264VideoEncoder, occupying when close then delete

Gaiger_Chen
New Contributor I
392 Views
Hi

I found a minior bug in UMC::H264VideoEncoder, the example is modify from http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/




void EncodeStream(Ipp8u *cYUVData, int imgWidth, int imgHeight, int frameNumber,
Ipp8u *cVideoData,int &VideoDataSize )
{

UMC::Status status;
UMC::MediaData DataOut; UMC::VideoData DataIn;
int FrameSize;

UMC::H264EncoderParams Params;
UMC::H264VideoEncoder *H264Encoder;

H264Encoder = new UMC::H264VideoEncoder;

Params.key_frame_controls.method=1;
Params.info.clip_info.height=imgHeight;
Params.info.clip_info.width=imgWidth;
Params.info.bitrate = 1000000;
Params.numThreads = 1;

if((status = H264Encoder->Init(&Params))!=UMC::UMC_OK)
return;

FrameSize = imgWidth*imgHeight*3/2;
DataIn.Init(imgWidth,imgHeight,UMC::YV12,8);
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);

DataOut.SetBufferPointer(cVideoData,MAXVIDEOSIZE);

VideoDataSize=0;
int nEncodedFrames=0;
while ( nEncodedFrames < frameNumber)
{
status = H264Encoder->GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK)
{
nEncodedFrames++;

VideoDataSize+=DataOut.GetDataSize();
DataOut.MoveDataPointer(DataOut.GetDataSize());

cYUVData+=FrameSize;
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);
}
}

H264Encoder->Close();
delete H264Encoder;

return;
}

then the program would crash in excuting delete H264Encoder, on H264ENC_MAKE_NAME in umc_h264_enc_cpb_tmp1.cpp.h for accessing a freed memory.


it is becouse the m_pEncoder_8u_16s is not been set as NULL.


thank you.
0 Kudos
2 Replies
Vladimir_Dudnik
Employee
392 Views
Thanks for reporting that issue. We will fix the problem.

Regards,
Vladimir
0 Kudos
Chao_Y_Intel
Moderator
392 Views

Hi Gaiger,

The fix has been included into 7.0.2 release. Thanks for your report.

Thanks,
Chao
0 Kudos
Reply