CBaseOutputPin.Deliver method

The Deliver method delivers a media sample to the connected input pin.


virtual HRESULT Deliver(
   IMediaSample *pSample



Pointer to the sample's IMediaSample interface.

Return value

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

Return code Description
Pin is not connected.


This method calls the IMemInputPin::Receive method on the input pin. Receive can block if the IMemInputPin::ReceiveCanBlock method returns S_OK.

Release the sample after calling this method. The input pin might hold a reference count on the sample, so do not reuse the sample. Always call the CBaseOutputPin::GetDeliveryBuffer method to obtain a new sample.

Hold the filter's critical section before calling this method. Otherwise, the pin might get disconnected during the method call. If the filter uses a worker thread to deliver samples, hold the critical section when the filter is ready to deliver a sample. Otherwise, you can hold the critical section in the filter's IMemInputPin::Receive method, where the filter processes samples.

Worker threads can create a potential deadlock. When the thread holds the critical section, it might wait on a state change in the filter. At the same time, the state change might be waiting for the thread to complete. To prevent this, the state-change code should signal an event that terminates the thread, and then wait for the thread to signal completion.


Amfilter.h (include Streams.h)
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBaseOutputPin Class