Clock Times

DirectShow defines two related clock times: reference time and stream time.

  • Reference time is the absolute time returned by the reference clock. (See Reference Clocks.)
  • Stream time is defined relative to when the graph last started running.
    • While the graph is running, stream time equals reference time minus start time.
    • While the graph is paused, stream time remains at the stream time when it was paused.
    • After a seek operation, stream time resets to zero.
    • While the graph is stopped, stream time is undefined.

When a media sample has a time stamp t, it means the sample should be rendered at stream time t. For this reason, stream time is also called presentation time.

When an application calls IMediaControl::Run to run the filter graph, the Filter Graph Manager calls IMediaFilter::Run on each filter. To compensate for the slight amount of time it takes for the filters to start running, the Filter Graph Manager specifies a start time slightly in the future.

Time and Clocks in DirectShow

Time Stamps