locked
MediaSession errors, sinks, and transcoding issues RRS feed

  • Question

  • Using Media Foundation, I'm writing an application that captures microphone data and plays it back through the speakers.

    To do this, the application enumerates audio endpoints, and instantiates an IMFMediaSource and IMFMediaSink. During testing, I was able to RequestSample from the media source, and verify that the captured audio was good.

    The application then creates a MediaSession and sets the topology consisting of nodes for the source and sink. The source node is connected to the sink node. I've used some of the ideas in the code for the wavsink sample app in the Windows SDK 7.1.

    After the MediaSession is Start'ed, I see events indicating that the topology is set, and the topology is read, and eventually that the MediaSession has started.  But I also see a couple of MEError events -- and I don't hear anything on the speakers.

    Q1: is there a way to find out what the errors are when they occur?

    Q2: does the MediaSession automatically handle different encoding formats between source and sink? (Maybe not, which may give rise to the errors I'm seeing, and why I'm not hearing any audio.)

    Eventually, I'm going to want to transcode audio between the microphone and a buffer (which I'll send over the wire). I've looked at the Transcoding API, and it doesn't do quite what I want, because the transcoded audio is written to a file. Instead, I want to grab the audio in memory. Can I setup a memory buffer as a sink, and plug that into my topology (and again, will the MediaSession handle transcoding for me)?

    Tuesday, January 27, 2015 1:43 AM

All replies

  • I'm thinking I want the AudioResampler DSP here, rather the MediaSession stuff. Does that sound right?
    Tuesday, January 27, 2015 7:34 PM
  • I got this to work, using the wavsink example from the Windows SDK as a guide. I replaced the source and sink there with the microphone and speaker devices. While it works, there's a good deal of lag and distortion in the output.
    Friday, January 30, 2015 12:35 AM