Time and the DataStreamer


One of the central concepts of streaming is the association of start time and duration with data. The chunks in the stream file have associated time information that is used by the different threads.

When the presentation time for a piece of data has passed, the streamer throws the data away and returns all resources associated with it to their respective free pools.

Note: If time for a piece of compressed video that was based on frame differencing passes, the streamer cannot discard it because differencing relies on the streamer having played all data. In that case, playback will halt.

The stream clock

To manage start time and duration associated with data, the DataStreamer maintains a time base known as the stream clock. Clock time is measured in standard Portfolio audio ticks, and runs 240 Hz.

The stream clock can be in one of the following states:

Note that the streamer thread delivers data for playback only if the clock is valid and running.

One important function of the clock is making synchronization of audio and video possible. The DataStreamer derives its time base from an audio channel managed by the audio subscriber and synchronizes the other subscribers to that time base.

Note: If there is no audio channel in your stream, you must explicitly set the clock to validate it with DSSetClock() for your stream to play back.