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
Announcements
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.

Skylake + latest drivers = Heap corruption when closing video encoder?

Peter_B_7
Beginner
2,824 Views

Hello,

we are developing a video playback and recording system using the Intel Media SDK. Experiments are conducted on two platforms:

A) The test system based on i5 4590T + Windows 7

B) The target hardware using an i5 6600 + Windows 8.1 Embedded.

Both systems use the same SDK version. System B has the latest graphics drivers, while system A uses some close to up-to-date drivers (since the latest versions support only 6th generation CPUs for now).

The software we developed so far runs smoothly on system A but has an issue on system B. The issue is observed when using MFXVideoENCODE and having it process (at least) one frame. If done, deleting the MFXVideoENCODE object does something to the mfxSession, which causes a heap corruption when deleting the respective MFXVideoSession later on.

The issue can easily be reproduced using the older (but very convenient) simple_3_encode provided with the package mediasdk-tutorials-0.0.3. We did the following modifications:

1st) We added

    #define _CRTDBG_MAP_ALLOC

    #include "crtdbg.h"

for getting a better overview of memory related issues

2nd) We added { } braces so that the variable "session" (constructed after the sink initialization) goes out of scope after mfxENC.Close() is called and surfaces are freed.

Running the code in debug mode breaks to MFXVideoSession::Close with the message "HEAP: Free Heap block xxxxx modified at yyyyy after it was freed" showing on the output.

Playing around, we declared MFXVideoSession::m_session as a public member and set it to NULL before "session" goes out of scope. This kind of "solves" the problem in terms of crashing. However, it causes some memory to leak, which isn't really acceptable either.

Is this a known issue with current drivers or the current SDK? As said, none of this can be observed on our hardware configuration A. Also, MFXVideoDECODE works fine on our hardware configuration B.

Thanks for any advice,

Peter

0 Kudos
22 Replies
OTorg
New Contributor III
266 Views

PS:
Yes, it's a very long story...
:)

0 Kudos
Sergey_Anufriev
Beginner
266 Views

Hello, Peter

Problem still exists. We tested the applications on the latest beta drivers 20.19.15.4474. The problem is also observed when using your samples provided with the SDK. 

"Free Heap block XX modified at YY after it was freed" (comment #11) occurs during a call 

mfxStatus MFX_DISP_HANDLE::UnLoadSelectedDLL(void)
{
...
mfxRes = (*(mfxStatus (MFX_CDECL *) (mfxSession)) pFunc) (session);
...
}

p.s At the moment, we had to turn off hardware encoding and decoding on the 6th generation processors. In this situation, we use the nvenc sdk for the transmission of 1080p/4K content...

0 Kudos
Reply