IMFRateControl::SetRate method

Sets the playback rate.


  BOOL  fThin,
  float flRate



If TRUE, the media streams are thinned. Otherwise, the stream is not thinned. For media sources and demultiplexers, the object must thin the streams when this parameter is TRUE. For downstream transforms, such as decoders and multiplexers, this parameter is informative; it notifies the object that the input streams are thinned. For information, see About Rate Control.


The requested playback rate. Postive values indicate forward playback, negative values indicate reverse playback, and zero indicates scrubbing (the source delivers a single frame).

Return Value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
The method succeeded.
The object does not support reverse playback.
The object does not support thinning.
The object does not support the requested playback rate.
The object cannot change to the new rate while in the running state.


The Media Session prevents some transitions between rate boundaries, depending on the current playback state:

Playback State Forward/Reverse Forward/Zero Reverse/Zero
Running No No No
Paused No Yes No
Stopped Yes Yes Yes

If the transition is not supported, the method returns MF_E_UNSUPPORTED_RATE_TRANSITION.

When a media source completes a call to SetRate, it sends the MESourceRateChanged event. Other pipeline components do not send this event.

If a media source switches between thinned and non-thinned playback, the streams send an MEStreamThinMode event to indicate the transition. Events from the media source are not synchronized with events from the media streams. After you receive the MESourceRateChanged event, you can still receive samples that were queued before the stream switched to thinned or non-thinned mode. The MEStreamThinMode event marks the exact point in the stream where the transition occurs.

When the Media Session completes a call to SetRate, it sends the MESessionRateChanged event.


Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header mfidl.h
Library Mfuuid.lib

See Also

How to Set the Playback Rate on the Media Session