My second MF Topology (presentation) freezes shortly after starting on Vista

Hello. I have been developing a media player application based on Media Foundation (MF). I start my presentations by calling "SetTopology(0,pTopology)". I want to implement a play list, so I have been allowing the code to call SetTopology(0, pTopology2) even when the first topology is still running.

My first presentation runs fine, but when it gets to the end, the second one starts and freezes almost immediately. I have noticed that if I "Pause" and then "Start" the presentation again, it renders the video at an accelerated rate until it catches up or freezes again... it typically quickly renders some and turns frozen almost immediately.

I will appreciate any suggestions.

Thanks!



Answer this question

My second MF Topology (presentation) freezes shortly after starting on Vista

  • ScottStonehouse

    Here follows a log with the sequence of events. Additional explanatory comments are enclosed in angled brackets <>.

     

    I have also noticed that sometimes the presentations play just fine, but that seems to be random and only a minority of times.

     

    Thanks.

     

    LOG:
        <Created the topology>

     

    CMfMediaSession::StartPresentation [SetTopology(0,pTopology)]

    CMfMediaSession::CreateSession

     

        <So far, created the media session and started to process events>

     

    Media event: MESessionTopologySet
    CMfMediaSession::OnTopologySet

    Media event: MESessionNotifyPresentationTime
    Media event: MESessionCapabilitiesChanged

    Media event: MESessionTopologyStatus
    MESessionTopologyStatus: [MF_TOPOSTATUS_READY]
    CMfMediaSession::OnTopologyStatusReady
    CMfMediaSession::StartPlayback

    Media event: MESessionTopologyStatus
    MESessionTopologyStatus: [MF_TOPOSTATUS_STARTED_SOURCE]
    Media event: MESessionCapabilitiesChanged

    Media event: MESessionStarted
    CMfMediaSession::OnSessionStarted

     

       <Here the first one is playing and I create and add the second one.>

     

    CMfMediaSession::StartPresentation [SetTopology(0,pTopology)]

     

       ...


    Media event: MESessionTopologySet
    CMfMediaSession::OnTopologySet

     

       ... <the new one is set, but the original is still playing.>


    Media event: MEEndOfPresentation   <the original one>
    CMfMediaSession::OnPresentationEnded

    Media event: MESessionTopologyStatus
    MESessionTopologyStatus: [MF_TOPOSTATUS_ENDED]
    CMfMediaSession::OnTopologyStatusEnded
    pTopology References: 6


    Media event: MESessionNotifyPresentationTime
    Media event: MESessionTopologyStatus
    MESessionTopologyStatus: [MF_TOPOSTATUS_SINK_SWITCHED]


        <The next event indicates that the second one is ready,

         so I start it with: 

            m_pSession->Start(NULL, &varStart);

        where varStart is a VT_EMPTY variant>

     

    Media event: MESessionTopologyStatus  
    MESessionTopologyStatus: [MF_TOPOSTATUS_READY]
    CMfMediaSession::OnTopologyStatusReady
    CMfMediaSession::StartPlayback  

    Media event: MESessionTopologyStatus
    MESessionTopologyStatus: [MF_TOPOSTATUS_STARTED_SOURCE]

     

         <One thing I noticed is that I did not receive a

          MESessionCapabilitiesChanged event here, as opposed

          to after starting the first topology, when I did
          receive it. See above.>

     

    Media event: MESessionStarted
    CMfMediaSession::OnSessionStarted

     

         <HERE I was FROZEN>

     

    CMfMediaSession::Pause
    Media event: MESessionCapabilitiesChanged
    Media event: MESessionPaused
    CMfMediaSession::OnSessionPaused
    CMfMediaSession::Play
    CMfMediaSession::StartPlayback
    Media event: MESessionCapabilitiesChanged
    Media event: MESessionStarted
    CMfMediaSession::OnSessionStarted

     

       <After pausing and starting, the presentation

        played at an increased speed to its end.>

     

    Media event: MEEndOfPresentation
    CMfMediaSession::OnPresentationEnded

    Media event: MESessionTopologyStatus
    MESessionTopologyStatus: [MF_TOPOSTATUS_ENDED]
    CMfMediaSession::OnTopologyStatusEnded
    pTopology References: 7

    Media event: MESessionCapabilitiesChanged

    Media event: MESessionEnded
    CMfMediaSession::OnSessionEnded


        <The I started the shutdown of everything>

     

    Media event: MESessionCapabilitiesChanged
    Media event: MESessionClosed
    CMfMediaSession::OnSessionClosed


  • ChoKamir

    The second Start() call (the one you make after getting MESessionTopologyStatus( MF_TOPOSTATUS_READY )) is unnecessary; you should just be able to sit back and let the Media Session take care of starting each presentation. Can you try that and let us know how that goes

    As for the freezing, well, I don't think that should have happened; a Start( VT_EMPTY ) should just do nothing if you're already playing. We'll try that on our side and see if we can reproduce the problem.



  • My second MF Topology (presentation) freezes shortly after starting on Vista