Seeking is slow RRS feed

  • Question

  • Hello all,

    I've reused the Video Playback, the Seeking, Fast Forward and Reverse playback and the MFPlayer samples to build a C++ COM dll, which I access through a WPF application. The only bonus over these samples is a custom EVR Renderer, I use to write D3D9Surfaces on a D3DImage control.

    My problem is that I have a very high latency when I seek through a video file, whereas the same video file is seeked very smoothly by the MFPlayer application sample.

    I've put a breakpoint in the SetPositionInternal function of the PlayerSeeking class, and it is called, but after an increasing amount of time. I've noticed that the first seeks I do are very slow, but once the video has been seeked, the next seeks are fast, unless I start the playback again.

    I've already looked in this forum, and I have seen this question, but I already use the op's answer.

    Do you have any ideas?

    Thanks in advance


    Monday, November 14, 2011 8:28 PM

All replies

  • I have noticed that using the custom EVR Renderer sample inside of the MFPlayer sample gives me the same high latency when seeking.

    Could it be the cause? If yes, why?

    Monday, November 14, 2011 9:18 PM
  • Hello all,

    I've investigated the problem using some Trace messages, and the delay I get is due to the Scheduler::Flush function.

    In this function, there is a WaitForMultipleObjects call, which has a 5 seconds timer, which is the delay I have.

    I suspect I don't manage the session states correctly, so would you please help me and tell me in which order I should set the player states when I seek the video using a trackbar?

    Currently, here is my workflow:

    1. OnMouseDown: Play the video and set Scrubbing on True
    2. OnMouseMove: Set seeking position
    3. OnMouseUp: Set Scrubbing on False and Pause the video

    Another weird trace message I get, is the clock being stopped while the video is seeked, whereas I don't call Stop on the MediaSession.

    Anyway, does anybody have a clue which could help me to understand what's wrong?

    Thanks in advance

    Monday, November 21, 2011 11:58 PM
  • If I decrease the scheduler timeout to 100ms instead of 5000ms, I have a smoother seeking.

    But unfortunately, I often see in the log messages that the clock is stopped when I seek a lot, despite the video is in Play or Pause state.

    What would be the cause?

    Tuesday, November 22, 2011 9:51 AM
  • I do not know why the clock would be getting stopped in your case.  The only times the session stops the clock are when IMFMediaSession::Stop is called or when reaching the end of the presentation.

    Saturday, December 17, 2011 2:01 AM