locked
IMFPresentationClock::GetTime method sometimes returns 0 although it shouldn't RRS feed

  • Question

  • Hi,

    I have an application where you can have multiple areas where videos are played. I sued the media session for playback. When playing my application asks with a frequency of 10 Hz where the video is so that it can display the current position to the user. 

    I have used something like this: 

      HRESULT hr = S_OK;
      IMFClock *pClock = NULL;
      IMFPresentationClock *pPrClock = NULL;

      hr = m_pSession->GetClock(&pClock);
      if (FAILED(hr))
      {
        return MF_E_NO_CLOCK;
      }
      else
      {
        do 
        {
          hr = pClock->QueryInterface(IID_PPV_ARGS(&pPrClock));
          BREAK_ON_FAIL(hr);
          hr = pPrClock->GetTime(llCurrentPossition);
          BREAK_ON_FAIL(hr);
        } while (false);    
      }

      SafeRelease(&pClock);
      SafeRelease(&pPrClock);
      return hr;

    If I use only one video then it is ok. I does what it should and I get the correct time. The problem arises when I have more than one area with a video in it. The areas are in different objects that use media foundation.

    In the 2 video scenario when I query for the current time I sometimes get the correct value and sometimes I get 0 (in the middle of the video). Does somebody have an explanation for this behavior? What is more confusing to me is that I don't get any error code. The returned HRESULT is S_OK.

    Thanks!

    Tuesday, May 6, 2014 1:58 PM