View Full Version : FrameGrabberListener stops getting events

August 29, 2005, 02:51:31
I've just started using GrabberListener to catch the FrameReady events from the 1394 frame grabber. I get frames when I issue the startLive(), but I stop getting frames after a random number of frames, so far anywhere from 1 to 61 frames. My CListener class doesn't seem to be getting any more frame events. I've only registered for the FRAMEREADY events, nothing else.

I used to use the old callback function method, where I created a tsFrameEndCallback structure with my callback function specified, then passed that to the Grabber setCallback method. However, apparently that is no longer supported in the 2.x libraries. The rest of the code is the same as before, only using the GrabberListener class to process the frames instead of the old callback function.

I am using the 2.1Dio3 libraries for this project under Visual Studio 2003.

Stefan Geissler
August 29, 2005, 12:55:43

Without having a look onto your source code, it is hard to make a diagnosis.
You are sure that the image processing in the CListener class does not block?

August 29, 2005, 18:36:21
The image processing in CListener takes the memory buffer, locks it, calls into the Java Native Interface to wrap the buffer in a native io bytebuffer, and then calls into the java code with that nio.bytebuffer for downstream processing. Upon return, the memory buffer is unlocked and the CListener image processing completes.

This is exactly the same code that was used with the older callback function in the 1.2 libraries, and everything worked ok there - the processing thread would return in plenty of time for the next frame. The image processing that I mentioned that calls into the JNI for downstream processing -- that java code copies the data into another buffer and notifies a waiting thread that data is available, then returns immediately, so the only time take to "process" from the C++ code's point of view is the time it would take to copy that data buffer (640 x 480 bytes).

I am using 32 memory buffers for the image capture. It doesn't seem as if I am running out of buffers since I get anywhere from 1 - 60 or so frames before things stop...


Stefan Geissler
August 30, 2005, 07:34:33

I suggest the memory buffers are all locked, but i am not sure. I suggest to create a loop, that can be used to check, wether all memorybuffers are locked:

for( i = 0; i < 32; i++ )
if( pMemBuffColl->getBuffer( i ).isLocked())
printf("%c ",97+i);
printf("%c ",65+i); // Capital chars.

This loop can be called, while the live video runs. If you do not use a console application, use "TRACE" instead of "printf". If a buffer is locked, its letter will be small one ("a b c ..."). If a buffer is not locked, its letter will be a capital ("A B C...").
I am not sure, whether it must be
pMemBuffColl->getBuffer( i ).isLocked()
pMemBuffColl->getBuffer( i )->isLocked()

but the compiler will tell you.
If you can see only small letters, then the memory buffer are all locked and frameReady() will not be called.
Please let me know your results.