I have been using the Android NDK Camera sample and with it one is able to read the frames with format AIMAGE_FORMAT_YUV_420_888
by using the yuvreader_
inside DrawFrame at 30 Hz. I validated that 30 Hz is achieved by recording the timestamp in each image and printing it. I am using a Samsung Galaxy S9.
I was now trying to obtain JPEG images instead of the YUV ones also at 30 Hz but have not yet succeed and was wondering if someone could help.
From what I understood, the capture session in this sample creates a request for both "preview" and a "still capture", where the yuv is used for preview and jpeg is used for the still capture. What I have done was to set the jpgReader_
as the preview one as well, and then I checked in the timestamp of the frames captured in the ImageCallback here (I commented out the step of writing to file, and just called AImage_delete(image) to clean the buffer instead). However, the result I get is frames with intervals of 33, 66, 99 and 133 ms, quite evenly distributed, so many frames often get skipped.
Any ideas of what the problem could be?