CSourceStream.DoBufferProcessingLoop 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 DoBufferProcessingLoop method generates media data and delivers it to the downstream input pin.

Syntax

virtual HRESULT DoBufferProcessingLoop();

Parameters

This method has no parameters.

Return value

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

Return code Description
S_FALSE
Thread received a stop request.
S_OK
Stream ended, or downstream filter is not accepting samples.

Remarks

This method implements the main loop that processes data and delivers it downstream. Each time through the loop, the method retrieves an empty media sample from the allocator. It passes the sample to the CSourceStream::FillBuffer method. The FillBuffer method, which the derived class must implement, generates media data and places it in the sample buffer.

The loop ends when any of the following occurs:

  • The input pin's IMemInputPin::Receive method rejects a sample.
  • The FillBuffer method returns S_FALSE, indicating the end of the stream, or returns an error code.
  • The thread receives a CSourceStream::Stop request.

The DoBufferProcessingLoop method handles the end-of-stream notification. If an error occurs, it sends an EC_ERRORABORT event to the filter graph manager.

Requirements

Requirement Value
Header
Source.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CSourceStream Class