COMException while using MediaFoundationReader

0

I'm trying to play .flac music file using NAudio and MS Media Foundation codecs. But whenever song hits end or is seeked near to end it throws an exception. Is there any way how to fix it or any alternative way how to play flacs?

Thrown exception

System.Runtime.InteropServices.COMException (0xC00D36E3): Exception from HRESULT: 0xC00D36E3

Code to load and play music

readerStream = new MediaFoundationReader(FilePath);
waveChannel = new WaveChannel32(readerStream);
readerStream = new DSPEffectStream(waveChannel, m_eqEffect);
postVolumeMeter = new MeteringSampleProvider(readerStream.ToSampleProvider());
waveOutDevice.Init(postVolumeMeter, true);

waveOutDevice.Play();

I have found some people with similar problem but without answers how to fix it. Discussion link

audio
com
naudio
ms-media-foundation
flac
asked on Stack Overflow Oct 11, 2014 by PSSGCSim • edited Oct 14, 2014 by Roman R.

1 Answer

1

0xC00D36E3 is MF_E_BAD_STARTUP_VERSION "You are calling MFStartup with the wrong MF_VERSION. Mismatched bits?". Which in turn means:

If MFStartup returns MF_E_BAD_STARTUP_VERSION, it means your application was compiled using a version of the Media Foundation headers that does not match the Media Foundation DLLs on your system.

The problem should be related to Media Foundation initialization, and of you don't do it explicitly then NAudio is supposedly somehow does it incorrectly (or uninitilaizes too early).

answered on Stack Overflow Oct 11, 2014 by Roman R.

User contributions licensed under CC BY-SA 3.0