CBaseRenderer.SourceThreadCanWait method
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The SourceThreadCanWait
method holds or releases the streaming thread.
Syntax
virtual HRESULT SourceThreadCanWait(
BOOL bCanWait
);
Parameters
-
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.
Return value
Returns S_OK.
Remarks
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.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|