locked
About ShutdownObject() of IMFActivate. RRS feed

  • Question

  • I have made OriginalSink and implemented IMFActivate, I could create instance of mySink in the PMPProcess.
    When the PartialTopology was sent to PMPHost, ActivateObject() of mySink(IMFActivate) was called from PMPSession.

     And then I have two questions.

     1. Although  ActivateObject() of mySink was called from PMPSession, ShutdownObject() of

          mySink was not called from PMPSession  .
      This is why?

    2. When PMPSession was called Shutdown(), Shutdown() of mySink was called synchronously.
      And mySink shut down myStreamSink.
      Is there any problem about that ShutdownObject() has never been called?

     

    Wednesday, February 21, 2007 11:36 AM

Answers

  • What you're seeing is expected behavior.  Your observation that there are two ways to shut a Media Sink down are correct: By calling IMFMediaSink::Shutdown directly, or by calling IMFActivate::ShutdownObject on the IMFActivate that created it.

    In practice, when you're using the MF Media Session, you should expect to see a direct IMFMediaSink::Shutdown() call in most cases.  There is a case in which you will see the Media Session attempt to shut down the Media Sink through IMFActivate::ShutdownObject; this happens if all of the following are true:

    1. The Media Sink in question was created by an IMFActivate
    2. The Media Session is switching topologies, and the Media Sink in question appears in the first topology but not the second.
    3. The application has not set the MF_TOPONODE_NOSHUTDOWN_ON_REMOVE attribute on that output node (this attribute overrides the Media Session's decision to shut down a Media Sink).

    The upshot is that your IMFActivate and IMFMediaSink implementations should be able to handle either one and shut the sink (and all its Stream Sinks) down from that call.

    Hope this helps.

    Wednesday, February 21, 2007 3:38 PM
  • You should implement both IMFMediaSink::Shutdown() and IMFActivate::ShutdownObject() such that if either one is called the object is properly cleaned up.

    Regarding your question about switching topologies:  I believe Becky was referring to the media session's ability to queue up multiple topologies, and switch from the current presentation to the queued up presentation. This happens if you call IMFMediaSession::SetTopology() multiple times in a given session.

    IMFTopoLoader::Load() is just used to resolve a partial topology to a full topology.  In many cases this will happen right after you set the topology on the session, which can happen any time before the first topology is finished.  Also, this won't be called automatically if you call IMFMediaSession::SetTopology() while specifying the flag: MFSESSION_SETTOPOLOGY_NORESOLUTION.

     

    Tuesday, February 27, 2007 6:50 AM

All replies

  • What you're seeing is expected behavior.  Your observation that there are two ways to shut a Media Sink down are correct: By calling IMFMediaSink::Shutdown directly, or by calling IMFActivate::ShutdownObject on the IMFActivate that created it.

    In practice, when you're using the MF Media Session, you should expect to see a direct IMFMediaSink::Shutdown() call in most cases.  There is a case in which you will see the Media Session attempt to shut down the Media Sink through IMFActivate::ShutdownObject; this happens if all of the following are true:

    1. The Media Sink in question was created by an IMFActivate
    2. The Media Session is switching topologies, and the Media Sink in question appears in the first topology but not the second.
    3. The application has not set the MF_TOPONODE_NOSHUTDOWN_ON_REMOVE attribute on that output node (this attribute overrides the Media Session's decision to shut down a Media Sink).

    The upshot is that your IMFActivate and IMFMediaSink implementations should be able to handle either one and shut the sink (and all its Stream Sinks) down from that call.

    Hope this helps.

    Wednesday, February 21, 2007 3:38 PM
  • Hi Becky!

    Thank you for your answer!

    I come to the conclusion that mySink should implement either IMFMediaSink::shutdown() or IMFActivate::shutdownObject().

     

    Please give another one piece of advice to me.

    I guess that IMFTopoLoader::Load() is what you said at  "The Media Session is switching topologies,".

    I guess that your answer means to switch the partial topology to full topoology.

    If I have a misunderstanding of my guess, please point out it.

     

    My best regards.

    Thursday, February 22, 2007 2:49 AM
  • You should implement both IMFMediaSink::Shutdown() and IMFActivate::ShutdownObject() such that if either one is called the object is properly cleaned up.

    Regarding your question about switching topologies:  I believe Becky was referring to the media session's ability to queue up multiple topologies, and switch from the current presentation to the queued up presentation. This happens if you call IMFMediaSession::SetTopology() multiple times in a given session.

    IMFTopoLoader::Load() is just used to resolve a partial topology to a full topology.  In many cases this will happen right after you set the topology on the session, which can happen any time before the first topology is finished.  Also, this won't be called automatically if you call IMFMediaSession::SetTopology() while specifying the flag: MFSESSION_SETTOPOLOGY_NORESOLUTION.

     

    Tuesday, February 27, 2007 6:50 AM
  • Hi Matthew!

    Thank you for your answer!

    I understand that I should implement both IMFMediaSink::Shutdown() and IMFActivate::ShutdownObject() .

    Friday, March 2, 2007 12:47 PM