To Manage Writer Latency

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

It takes time for the writer to process samples. The amount of time between passing an input sample and the writing of an output sample is called the latency of the writer. A number of factors contribute to writer latency, and you can reduce it in several ways.

The most obvious factor involved in writer latency is the time it takes to compress a sample. Under most circumstances, you will have little or no control over this. If bandwidth is not a big concern, you can reduce latency by using less compression. Of course, you can achieve the least latency by passing samples that are already compressed.

The next factor, and one over which you usually do have control, is the order in which samples are passed to the reader. You can achieve better latency by passing samples in order of presentation time, and by ensuring that the input samples are well synchronized between all input streams. The greater the discrepancy in presentation times between the samples for different streams, the more latency will result. You can set a maximum for the discrepancy between input samples by calling IWMWriterAdvanced::SetSyncTolerance.

Writing ASF Files