|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Quality control is a mechanism for adjusting the rate of data flow through the filter graph in response to run-time performance. If a renderer filter is receiving too much data or too little data, it can send a quality message. The quality message requests an adjustment in the data rate. By default, quality messages travel upstream from the renderer until they reach a filter that can respond (if any). An application can also implement a custom quality manager. In that case, the renderer passes quality messages directly to the application's quality manager.
This article contains the following topics.
Quality messages are defined with the Qualitystructure. This structure contains the following members:
For example, suppose that a sample with a time stamp of 240 milliseconds (ms) reaches the renderer at 280 ms, stream time. The renderer creates a quality message of type Famine. The sample arrived 40 ms late, so the Latemember is 400000. (All reference times are in 100-nanosecond units.) The TimeStampmember is 2400000.
For the Proportionmember, the renderer might use a running average to calculate the value. Perhaps samples have been arriving on time, and this sample is an anomaly. In that case the renderer might request only a small correction. On the other hand, if samples are consistently late, the renderer might request a larger correction.
Quality control is handled through the IQualityControlinterface. It contains two methods.
An object that implements IQualityControlreceives quality messages through its Notifymethod. It can either handle the message or pass the message to another object. If the application calls the object's SetSinkmethod, the object should delegate quality control to the specified quality manager.
The filter base classesimplement some default behaviors for video quality control.
Quality messages start at the renderer. The base class for video renderers is CBaseVideoRenderer, which has the following behavior:
What happens next depends on the upstream filter. Typically, this is a transform filter. The base class for transform filters is CTransformFilter, which uses the CTransformInputPinand CTransformOutputPinclasses to implement input and output pins. Together, these classes have the following behavior:
Assuming that no transform filter handles the quality message, the message eventually reaches the output pin on the source filter. In the base classes, CBasePin::Notifyreturns E_NOTIMPL. How a particular source filter handles quality messages depends on the nature of the source. Some sources, such as live video capture, cannot perform meaningful quality control. Other sources can adjust the rate at which they deliver samples.
The base video renderer implements IQualityControl::Notify, which means you can pass quality messages to the renderer itself. If you set the Proportionmember to a value less than 1000, the video renderer inserts a wait period between each frame that it renders, in effect slowing down the renderer. (You might do this to reduce system usage, for example.) For more information, see CBaseVideoRenderer::ThrottleWait. Setting the Proportionmember to a value greater than 1000 has no effect.
Last updated on Tuesday, May 18, 2004