locked
When in a media session lifecycle can I get IMFAudioPolicy? RRS feed

  • Question

  • Hey all, I am fairly new to the media foundation stuff and playing around with it for a personal project.  Assume I am loading an audio file and want to customize the session identifier that appears in the Windows volume control popup.  I know I can do this with IMFAudioPolicy, and I know I can get IMFAudioPolicy via a call to GetService on my IMFMediaSession requesting MR_AUDIO_POLICY_SERVICE for the service id.  The thing I am seeing is that it doesn't appear to be available until AFTER I call IMFMediaSession::Start.  Is there a media event I can listen to that would signal that a GetService request for MR_AUDIO_POLICY_SERVICE would succeed?  Or is it easiest/safest to just postpone requesting it until after I call IMFMediaSession::Start?

    Ryan

    Tuesday, December 28, 2010 11:05 PM

Answers

  • While it seems a bit flaky to do immediately after calling IMFSession::Start (likely due to the async nature of the session start) it seems more reliable if I do it on reciept of the MESessionStarted event, so that is what I have taken to doing.

    It would be nice if these kind of sequence points were documented somewhere, at least for the main services exposed via the session, otherwise it seems hard to write reliable code.

    Ryan

    Thursday, December 30, 2010 1:00 AM

All replies

  • While it seems a bit flaky to do immediately after calling IMFSession::Start (likely due to the async nature of the session start) it seems more reliable if I do it on reciept of the MESessionStarted event, so that is what I have taken to doing.

    It would be nice if these kind of sequence points were documented somewhere, at least for the main services exposed via the session, otherwise it seems hard to write reliable code.

    Ryan

    Thursday, December 30, 2010 1:00 AM
  • It is safe to retrieve topology services after MESessionStarted.  MESessionTopologyStatus with MF_TOPOSTATUS_READY is the earliest event that indicates that a topology is loaded into the session and ready to expose services.  This behavior is documented in the MF_TOPOSTATUS page, but its a 'look up how to spell a word in the dictionary' kind of problem -- if you do not already know the solution, it is hard to find the right documentation.  Maybe the media session events page can have a high level overview of event sequences and what actions they might trigger.

    Friday, December 31, 2010 2:22 AM