Click to See Complete Forum and Search --> : [RESOLVED] DirectShow filters synchronization


r_gueorg
September 10th, 2008, 12:37 PM
Hi,

I am trying to implement a filter graph consisting only of a source
filter and renderer. This is based on a code base with 3 filters
impementation - source, transform and renderer.

The transform filter was doing the decompression of the video stream
and passing the samples downstream to the renderer. I moved the
decompressor functionality into the source filter and reconciled the
media types and transport b/w the source filter and renderer.

The problem is that the stream stops after decompressing a single
frame because the second time around the allocator does not return (I
think because of a deadlock).
The input pin and output pin of the transform filter were synched
using the m_csReceive lock. With the transform filter gone, how do I
go about synchronizing the media stream b/w source and renderer? Do I
need to override the Receive() method on the renderer input pin?

The second call (after rendering the first and only frame) IMemAllocator::GetBuffer returns only after I stop the graph and the result is VFW_E_NOT_COMMITTED , although Decommit
() never gets hit an the m_pAllocator is still a valid pointer.

Thank you very much in advance.

r_gueorg
September 16th, 2008, 03:33 PM
The ref count on the IMediaSample* pSample interface ptr was incorrect. So when the input pin tries to allocate a buffer the pSample is not yet available in the pool. A detailed look at "Samples and Allocators" in MSDN DirectShow help was all that was needed. Remember that if the sampe is processed on a worker thread its ref count is increased.

Hope this helps somebody else developing for DirectShow.