|Microsoft DirectX 9.0|
The SourceThreadCanWait method holds or releases the streaming thread.
virtual HRESULT SourceThreadCanWait( BOOL bCanWait );
Boolean value indicating whether to hold the streaming thread. If TRUE, the streaming thread is blocked while the filter waits to render the next samples. If FALSE, the streaming thread is released.
Calling the SourceThreadCanWait method with the value FALSE forces the filter to return from a blocked IMemInputPin::Receive call. When the filter is running, it blocks Receive calls until the current sample's presentation time. When the filter is paused, it blocks Receive calls indefinitely. This behavior regulates the flow of data in the stream. When the filter is stopped or flushing, however, it should not block.
The blocking is controlled by the CBaseRenderer::WaitForRenderTime method, which waits on two events: CBaseRenderer::m_RenderEvent and CBaseRenderer::m_ThreadSignal. The m_RenderEvent event is signaled when the presentation time arrives. The m_ThreadSignal event is signaled when SourceThreadCanWait is called with the value FALSE. Calling SourceThreadCanWait with the value TRUE resets the event.
The CBaseRenderer::Stop and CBaseRenderer::BeginFlush methods call SourceThreadCanWait with the value FALSE (releasing the streaming thread). The CBaseRenderer::Pause, CBaseRenderer::Run, and CBaseRenderer::EndFlush methods call SourceThreadCanWait with the value TRUE.