tags:

views:

34

answers:

1

Does anybody know any reasons why IMemAllocator:GetBuffer (Directshow) hangs, apart from all samples being in use?

I have a directshow application which uses GMFBridge by Geraint Davies to connect two graphs. The GMFBridge is used to be able to switch inputs, but I am not switching in this situation. The application captures audio and video, and should do that non-stop. But after about 10 hours it stops. I found out both audio and video got stuck in a call to IMemAllocator:GetBuffer:

/* _COM_SMARTPTR_TYPEDEF(IMemAllocator, IID_IMemAllocator); */
/* IMemAllocatorPtr m_pCopyAllocator; */

hr = m_pCopyAllocator->GetBuffer(&pOut, NULL, NULL, 0);

If all samples are in use, this function can block, but I am pretty sure this is not the case. There are two threads calling this function, one for the video and one for the audio samples. The Audio thread blocks first, and after the GetBuffer has returned a buffer for almost 60 video samples, the video thread blocks too. (this is about 2 seconds later)

After almost 8 hours both threads continue for a small period, first the audio thread, and after 45 buffers for audio samples have been returned, the video thread unblocks too.

So because both threads do not block at the same time, it looks to me there is not a problem with all samples being in use.

The stacktrace shows a function inside quartz.dll is being called at that moment.

UPDATE

It looks like there was a memoryleak caused by decoder filters already installed on the pc. The graph included decoding of mpeg, for example the audio decoding used a cyberlink decoder. After installing ffdshow, the ffdshow audio + video decoder was used instead, and the problem seems to be disappeared. Lesson learned, do not depend automatically on existing filters.

+1  A: 

Not sure that I can debug this from the info given. Can you create a log file (create an empty file c:\gmfbridge.txt, run until it hangs, then zip the file and email it). Also, if you set up your symbols with _NT_SYMBOL_PATH, you could look at the stack trace to see where in quartz.dll the various threads are.

G

Geraint Davies
thx, going to try it.
Wimmel
further investigations show there is a memory leak somewhere. So that explains why GetBuffer hangs. First going to check my application. If I think the memoryleak is caused by GMFBridge, I will contact you. Thank you for replying here.
Wimmel
It seems like directshow filters of other software installed on the pc caused a memory leak. So it is completely unrelated to GMFBridge. It just made the problem surface.
Wimmel