locked
protectedplayback sample, explain the close event RRS feed

  • Question

  • ProtectedPlayback sample have a close event. It is never explained why the event is used.

    Can somebody from the Media foundation team explain why an event was used ?

    You are able to modify the code to remove the event so was that event just a quick and dirt way to get the sample code ready or is it a good reason for it ?

    I am very tempted to rewrite the sample to remove the event.

    Tuesday, May 24, 2011 12:26 AM

All replies

  • Media Foundation is heavily asynchronous; many function calls return immediately and signal completion with an event or callback.  The m_hCloseEvent in the ProtectedPlayback sample is used to wait on the completion of the IMFMediaSession::Close call.  Otherwise, the application might exit before the close is completed.  For playback this typically is not a big deal as Close does not do much.  For file writing situations, though, cleanly completing Close is important for ensuring that the output file gets written correctly.
    Tuesday, July 26, 2011 7:15 PM