I am working with a TX1 and the Argus software for interfacing with a camera. I am looking to issue a repeat() request to the camera, and use a loop to continuously process images as soon as they are taken. In the Argus library, there is a sample program called “yuvJpeg” that does exactly this. This program is very similar to my usage and structure of my code.
The sample program (“yuvJpeg”), the consumer retrieves the image through the call
iFrameConsumer->acquireFrame()
. The function acquireFrame() has an optional argument that allows the user to specify a timeout.
By default, acquireFrame() waits indefinitely until a frame is ready to be ready, and does not return until a frame is acquired.
If a timeout is optionally specified, acquireFrame() will return if a frame cannot be acquired in the timeout time. Unfortunately, this causes a problem the next time you call acquireFrame(), illustrated in the following snippets:
Expected behavior:
// suppose a frame is not yet ready
Argus::UniqueObj<EGLStream::Frame> frame(iFrameConsumer->acquireFrame(10000000, &status));
// call will fail after 10ms and set status to Argus::STATUS_TIMEOUT
// ... some other things happen and some time elapses
// suppose a frame is now ready
Argus::UniqueObj<EGLStream::Frame> frame(iFrameConsumer->acquireFrame(10000000, &status));
// I would expect this call to succeed without problem, get the frame properly, and set status to Argus::STATUS_OK
Actual behavior:
// suppose a frame is not yet ready
Argus::UniqueObj<EGLStream::Frame> frame(iFrameConsumer->acquireFrame(10000000, &status));
// call will fail after 10ms and set status to Argus::STATUS_TIMEOUT
// ... some other things happen and some time elapses
// suppose a frame is now ready
Argus::UniqueObj<EGLStream::Frame> frame(iFrameConsumer->acquireFrame(10000000, &status));
// This fails immediately and sets status to STATUS::UNAVAILABLE and sends an error to outputstream:
// (Argus) Error InvalidState: Max frames acquired (in src/eglstream/FrameConsumerImpl.cpp, function acquireFrame(), line 254)
This isn’t a total mystery because the documentation for acquireFrame says something about “max frames”:
/**
* Acquires a new frame from the FrameConsumer, returning a Frame object. If the maximum
* number of frames are already acquired from the stream, an error will be returned
* immediately .........
What does this mean? What does the “maximum number of frames acquired from the stream” mean? I notice that you can change this value when you create the FrameConsumer (and doing so appears to fix the above problem), but what does changing this value actually do? It’s not well explained in the headers. Any ideas? Thanks!