Search code examples
audiocomdirectxms-media-foundation

Media Foundation IMFMediaSource::CreatePresentationDescriptor invocation never ends


I'm triying to use Media Foundation to play mp3 file and I have a problem getting PresentationDesctiptor using CreatePresentationDescriptor method

What am I doing:

  • Start MF using MFStartup
  • Create session using MFCreateMediaSession
  • Create SourceResolver using MFCreateSourceResolver
  • Create MediaSource using CreateObjectFromURL from SourceResolver
  • Create topology using MFCreateTopology
  • Trying to create PresentationDescriptor using CreatePresentationDescriptor from MediaSource

When I call CreatePresentationDescriptor no error/exception occurs it just stands there and does nothing. When I pause Visual Strudio it indicates that program is still waiting for method to finish. What am I doing wrong ?


Solution

  • I did not metion that I use C# for this (did not think this was relevant)

    The problem was that when importing com interfaces in C# you need to import all methods of interface not only those that are called. Some methods can call not imported methods and cause Access Violation that is not reported to Visual Strudio debugger and as a result it seems like method is never finished invokink.