Microsoft DirectX 9.0


The GetSampleTimes method retrieves the time stamps from a sample.


virtual HRESULT GetSampleTimes(
    IMediaSample *pMediaSample,
    REFERENCE_TIME *pStartTime,



Pointer to the sample's IMediaSample interface.


Pointer to a variable that receives the start time.


Pointer to a variable that receives the end time.

Return Value

Returns an HRESULT value. Possible values include those shown in the following table.

Value Description
S_OK The sample should be rendered immediately.
S_FALSE The sample should be scheduled for rendering, based on the time stamps.
E_FAIL Do not render this sample.
VFW_E_START_TIME_AFTER_END Bad time stamp: The end time is earlier than the start time.


The filter calls this method to determine how it should handle a sample. If the return value is S_OK, the filter renders the sample immediately. If the return value is S_FALSE, the filter schedules the sample for rendering, based on the time stamps. If the return value is an error code, the filter rejects the sample.

This method returns S_OK if the sample has no time stamps, or if the filter does not have a reference clock. Otherwise, it returns the value of the CBaseRenderer::ShouldDrawSampleNow method. In the base class, ShouldDrawSampleNow always returns S_FALSE. The derived class can override this behavior. For example, if the derived class implements quality control management, it might return E_FAIL to drop a sample.

See Also