/// <summary>
        /// Initializes a new instance of the <see cref="MFSessionEventListener"/> class.
        /// </summary>
        /// <param name="session">The session to listen to.</param>
        private MFSessionEventListener(MF.MediaSession session)
        {
            m_syncContext = SynchronizationContext.Current;
            m_session     = session;

            m_asyncEventWaiters     = new List <Func <MF.MediaEvent, bool> >();
            m_asyncEventWaitersLock = new object();

            // Start listening on the session object
            m_session.BeginGetEvent(this, null);
        }
 /// <summary>
 /// Attaches this listener on the given session.
 /// </summary>
 /// <param name="session">The session object to attach to.</param>
 internal static MFSessionEventListener AttachTo(MF.MediaSession session)
 {
     return(new MFSessionEventListener(session));
 }