The time stamp defines a media sample's start and finish times, measured in stream time. The time stamp is sometimes called the presentation time.
When a renderer filter receives a sample, it schedules rendering based on the time stamp. If the sample arrives late, or has no time stamp, the filter renders the sample immediately. Otherwise, the filter waits until the sample's start time before it renders the sample
Source filters and parser filters are responsible for setting the correct time stamps on the samples they process. Use the following guidelines.
File playback: The first sample is time stamped with a start time of zero. Subsequent time stamps are determined by the sample length and the playback rate, which itself is determined by the file format
Video and audio capture: Every sample is time stamped with a start time equal to the stream time when it was captured. Video preview frames are an exception. Because of graph latency, a preview frame that is time stamped with the current stream time will always arrive late at the video renderer The DirectShow component responsible for playing the video. Some renderers might have useful settings you can adjust if you have problems playing the video.. This may cause the renderer to drop frames, in an attempt at quality control. Therefore, preview frames should not be time stamped.
To set the time stamp on a sample, call the ltmmMediaSample.SetTime method.
Optionally, the filter can also specify a media time for the sample. In a video stream The portion of the file holding the video data. The video data might be compressed to save disk space. The data has to be decompressed using a video decompressor Software component that decompresses video. It must be designed to work with VFW or DirectShow. Note that different compression methods require different decompressors. There is no universal decompressor capable of decoding all compressed streams. before you can play (see) it., media time represents the frame number. In an audio stream The portion of the file holding the audio data. The audio data might be compressed to save disk space. The data has to be decompressed using an audio decompressor oftware component which decompresses audio. It must be designed to work with ACM or DirectShow. Note that different compression methods require different decompressors. There is no universal decompressor capable of decoding all compressed streams. before you can play (hear) it., media time represents the sample number in the packet. For example, if each packet contains one second of 44.1 kilohertz (kHz) audio, the first packet has a media start time of zero and a media stop time of 44100. In a seekable stream, the media time is always relative to the start time of the stream. For example, suppose you seek to 2 seconds from the start of a 15-fps video stream. The first media sample after the seek has a time stamp of zero but a media time of 30.
Renderer and mux filters can use the media time to determine whether frames or samples have been dropped, by checking for gaps. However, filters are not required to set the media time. To set the media time on a sample, call the ltmmMediaSample.SetMediaTime method.