'AImageReader_acquireLatestImage returns AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE
I am developing an application where I am reading Camera raw frames from AImageReader_acquireLatestImage and sending to gstreamer appsrc for further processing.
I am capturing at FULL HD and 60fps.
When just Image is read and deleted in onImageAvailable callback, I get proper 60 frames per second.
But when I start sending frames to gstreamer pipeline, sometimes I start getting AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE error when trying to get latest Image.
Solution 1:[1]
When you add an extra delay to the frame processing (long enough to get more frames), the following callbacks are getting queued. The invocation of AImageReader_acquireLatestImage withing the next callback (the first one from the callback queue) acquires the latest image from the image reader's queue, dropping older images, so in the time of execution of the following callbacks (from the queue, so almost instantly after the previous callback) image reader's queue is still empty.
If every frame matters to you, you should eather use AImageReader_acquireNextImage or drop acquired images to some async queue and process them within another thread. In the other case, just return from the callback listener on AMEDIA_IMGREADER_NO_BUFFER_AVAILABLE.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eugene Weiss |
