Media Foundation will not release a file after MFShutdown is called RRS feed

  • Question

  • We are using the now deprecated IMFPMediaPlayer for a small media player that is embedded in a larger Java Desktop Application.  We use the IMFPMediaPlayer::CreateMediaItemFromURL with a call back object.  Everything related to Media Foundation is queued into a single thread with a message pump and play, pause, sink, etc works fine. However, after MFShutdown, the Java Process can not delete the file that was created to play because the file is still held by the MFPlay.dll process (looked through with System Process Explorer).  The fact that MFPlay is still around bugs me.

    I put in logging to make sure that all of our Objects have the appropriate Release() (and that the Ref Count is 1) on shutdown.  MFShutdown returns a S_OK.  

    I originally wrote this so that MFStartup and MFShutdown where not called by our C++ code, but once this delete bug surfaced, I tried forcing the shutdown.

    Basically, the Java App downloads a zip file full of media, extracts the media to the temp folder, then plays the media as needed - once the media is played, it should be deleted.  Everything but the delete after MFShutdown.

    Thanks in advance.

    Monday, May 12, 2014 7:39 PM

All replies

  • Hello.

    Yes IMFPMediaPlayer is deprecated : IMFPMediaPlayer

    "Important  Deprecated. This API may be removed from future releases of Windows. Applications should use the Media Session for playback."

    So it will be hard to find a workaround to your problem, now this interface is deprecated. You have to use MediaSession.

    Friday, May 30, 2014 2:37 AM