media foundation decoder dll is unloaded too early and crushed on windows8 ,desktop app RRS feed

  • Question

  • Hello,

      I am developing a media transcode application in desktop on the platform of windows8 , the version is enterprise build 9200.

     the app pipeline is mostly like this:

        demux(ourself media foundation demux) -> decoder(ourself media foundation decoder) -> encoder(custom media foundation encoder) -> mux(custom media foundation sink.

       This pipeline is working fine in windows7, but when run on win8, the application crushed after 10 minutes or more. 

       I noticed that the dll that contains the decoder is unloaded during playback, this causes crush in the application.

    'TestTranscode.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcp110d.dll'
    'TestTranscode.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\msvcr110d.dll'
    First-chance exception at 0x6335AA90 in TestTranscode.exe: 0xC0000005: Access violation executing location 0x6335AA90.
    'TestTranscode.exe' (Win32): Unloaded 'E:\MediaFoundation\AudioDecoder\AudioDecoder_2010__Build\Win32\Debug\AudioDecoder.dll'
    Unhandled exception at 0x63439D20 in TestTranscode.exe: 0xC00001A5: An invalid exception handler routine has been detected (parameters: 0x00000003).

     I have found some info  at


    but it's about the metro style app. So I wonder if it's the problem of media foundation in windows8 , if it is, how can I avoid dll not to be unload too early.

    Thanks in advance.

    Wednesday, September 19, 2012 5:48 AM

All replies

  • media foundation will unload  dll  too early, i think it's a bug. but we can prevent being unload  when system call DllCanUnloadNow by return S_FALSE.
    Wednesday, September 19, 2012 9:28 AM
  • Media Foundation does not manage the loading or unloading of DLLs -- this is either handled by COM (if using a COM CLSID for the transform) or by the application.  Your DllCanUnloadNow implementation must return S_FALSE while there are active objects created from your DLL.
    Tuesday, October 23, 2012 11:20 PM