Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3056 Discussions

Do I need to free pfxBitstream->Data when done with it?

New Contributor I

I currently have mfxBitstream *pMfxBitstream that comes out of EncodeFrameAsync

At that point pfxBitstream->data contains data, however after writing that data to a file or copying it somewhere else, I no longer need it

Is setting pMfxBitstream->DataLength = 0; enough as shown by the example?  Or should I also free pMfxBitstream->Data if I intent to use it repeatedly and avoid memory leaks?  Or would freeing it potentially cause problems?

Thank you.

0 Kudos
1 Reply

Hi Matthew,

You do not have to free any mfxBitStream buffers during execution. The samples provided with the Media SDK showcase the correct usage. In essence just allocate sufficient buffer before starting processing then free it after all frames have been completely processed.


0 Kudos