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.

Crash in libmfxsw32.dll when packaging decode sample in a DLL

Donald_G_
Beginner
533 Views

I have started with the main video decode sample (the one with HEVC, MVC, and VP8 support etc.) I stripped it down to only MVC decode with MFX_D3D11 support turned off. I get an EXE decoder that works perfectly and does not crash. Building with VS 2013 Express on a Win8 machine.

Now, I take the files from the EXE decoder and add them to an existing Avisynth DLL project and change _tmain() name to sample_main(). Everything builds fine. I call sample_main() from a constructor in the Avisynth code and it runs, decodes fine, writes the two YUV files and then tries to exit. However, on exit, when the decdoing pipeline closes I get a crash when m_pmfxDEC is freed in CDecodingPipeline::Close(), as follows:

void CDecodingPipeline::Close()

{

...

WipeMfxBitstream(&m_mfxBS); // does not crash

MSDK_SAFE_DELETE(&m_pmfxDEC); // crashes here

The crash is: exception at 0x5D56F488 (libmfxsw32.dll)

Please help me to understand why this crash is occurring when I package the decoder in a DLL and how I might fix it. Thank you.

 

0 Kudos
6 Replies
Anthony_P_Intel
Employee
533 Views

Hi,

There may be difference in how the integrated code is calling the sample code.

The destructor of the MFXVIdeoDECODE object m_pmfxDEC should be calling its "Close()" function (which just calls MFXVideoDECODE_Close). Is it possible the MediaSDK 'session' has been closed prior to the decoder being closed/deleted ?

By stepping into the MSDK_SAFE_DELETE(&m_pmfxDEC) call with debugger, can you tell if crash is on the call to "Close" or is it afterward when object is being deleted?

You can also try using the mediasdk_tracer tool to capture log of both cases and compare.  (The tool is at <install dir>\tools\mediasdk_tracer.  Default location is C:\Program Files\Intel\Media SDK 2014 for Clients\tools\mediasdk_tracer.)

 

 

0 Kudos
Donald_G_
Beginner
533 Views

Thanks for your help.

It happens in the MSDK_SAFE_DELETE macro when the delete [] occurs.

0 Kudos
Donald_G_
Beginner
533 Views

Correction: delete (not delete [])

0 Kudos
Donald_G_
Beginner
533 Views

Some of my replies are getting moderated. It is very irritating.

It crashes in the delete for m_pmfxDEC

The tracer crashes for me and so is unusable.

0 Kudos
Donald_G_
Beginner
533 Views

The session is not getting closed before this delete.

0 Kudos
Anthony_P_Intel
Employee
533 Views

Hmm, the tracer should not be having any issue. Any information on how it is crashing (and/or system configuration and CPU would be appreciated).

Can you try directly calling m_pmfxDEC->Close(); just prior to the MSDK_SAFE_DELETE(&m_pmfxDEC) call?

(While this should make no difference at all, it may help.)

Also, please make sure the "Avisynth DLL" is linking with the same/new "Media SDK 2014" libmfx.lib that the sample code is using (or is being built with code that compiles this).

AND.....

When the application runs, the MediaSDK dispatching code (libmfx.lib) tries to find libmfxsw32.dll in local directory and then on "PATH".  Its possible that your "Avisynth DLL" may be finding another (old) version of libmfxsw32.dll than the one you intend.

There is system analyzer tool (in same path as tracer) that can help show what MediaSDK libraries are installed on your system.  The information it outputs may help us understand what is occurring.

 

0 Kudos
Reply