PDA

View Full Version : snapImages timeout?



celstark
April 6, 2007, 02:47:24
I am asking snapImages to grab individual frames and by and large, it is working quite well. I do not need high framerates here, so grabbing one at a time and not using callbacks is far easier and should suffice. The problem is that if I load up the CPU or switch back and forth to my app (invoking some delays) I get an error at times here saying:

"the timeout passed to snapImages(...) did elapse before all images could be snaped"

Now, the docs suggest the default timeout is infinite, so this shouldn't timeout. I've passed in:

err = pSink->snapImages( 1,15000 );

So, we should wait 15s for a timeout and we are far from that - it's pretty immediate.

Currently, on connect, I:
// Setup the frame handler
pSink = FrameHandlerSink::create( eY800, 4 ); // not sure why I even need 4...
pSink->setSnapMode( true );
grabber.setSinkType(pSink);

// Get the stream prepared, but don't start yet - going to start/stop on each frame grab
grabber.prepareLive(false); // not using their renderer

Then when I need a frame:
retval = grabber.startLive(false);
if (!retval) {
wxMessageBox(_T("Could not start video stream"));
return true;
}

// grab the next frame
err = pSink->snapImages( 1,15000 );
if( err.isError() ) {
wxMessageBox(_T("Error capturing image: ") + wxString(err.c_str()));
Disconnect();
return true;
}

// Load data
imgptr = (unsigned char *) pSink->getLastAcqMemBuffer()->getPtr();
for (i=0; i<img.NPixels; i++, dataptr++, imgptr++)
*dataptr = (unsigned short) *imgptr;

grabber.suspendLive();

The stream starts fine but we hit an error on the snapImages() call saying it's a timeout. If I let the app have focus all the time, we stream just fine.

It would seem as if there is some timeout coded in here and that it's not respecting what's being passed in. Any thoughts / experiences out there?

Craig

Tim Cassens
April 16, 2007, 15:55:59
Hello

If you still have this problem:
- Which video capture device are you using?
- Are you able to reproduce the timeout error using a small sample program? If yes, please send it attached to an email to support@imagingcontrol.com .

Best regards
Tim Cassens