Re: A question about outpin delivering sample
- From: "Chris P." <msdn@xxxxxxxxxxxx>
- Date: Wed, 30 May 2007 08:38:50 -0400
On 29 May 2007 20:00:05 -0700, acolor0429@xxxxxxxxx wrote:
I am new to learning DirectShow.
My question is how to be more efficient and stable to deliver sample
to downstream. The input data is a network stream, the data is
received and put into my buffer. Then, downstream filter will call
DoBufferProcessingLoop() and FillBuffer() on my OutPin to get the
sample. I am confused of how to handle the case if there is no data
in the buffer. In this situation (no data to be delivered), I will
poll the buffer until there is something to be sent. But I sometimes
meet crash when the buffer is empty. The crash is due to "Deliver()"
function pointer is wrong (Access Violation). This is very strange
because this looks like some object is already released. Do you know
when will happen ? and how to improve my outpin implementation.
First you're logic is a bit backwards. DoBufferProcessingLoop() is
effectively part of your output pin (it's in the base class), this is your
streaming thread. This thread requests a buffer with GetMediaSample(),
calls your FillBuffer() and then attempts to Deliver() down stream to the
connected pin.
The safest thing to do if you don't have any data is to not deliver.
Without overriding the DoBufferProcessingLoop() you can do this by blocking
in FillBuffer() while waiting for data. Delivering empty buffers
downstream may or may not work depending on the connected filters and the
media type.
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
.
- References:
- A question about outpin delivering sample
- From: acolor0429
- A question about outpin delivering sample
- Prev by Date: Re: PushSource Filter hangs for x seconds (after displaying two frames) when I Stop and Restart the Graph.
- Next by Date: Memory Leak in DirectShow
- Previous by thread: A question about outpin delivering sample
- Next by thread: problem in mux filter with two input pin... plz help
- Index(es):
Relevant Pages
|