The limiting factor is how fast you can move a large pile of data. There is a similar discussion here . You have three tasks: (1) get the image, (2) save the image ("capture") and (3) display the image. (If I misunderstood your question, and you donβt need # 2, then the Surface
cameraβs preview mode will do what you want at high speed.)
One approach to efficient use of bandwidth available on Android 4.3 is to feed a Surface
camera preview to an AVC encoder, save the encoded MPEG stream, and then decode the frames for display. Buffers from the camera can be fed to the MediaCodec
encoder without the need to copy them or convert the data to another format. (See the CameraToMpegTest example.) This approach may not be compatible with one of your stated goals: the compression applied to each frame may lower the quality below acceptable levels.
If you need to save the whole frame, you need to copy the data, perhaps several times, and write it to disk. The larger the frame, the more data you need to move, and the slower everything. For example, a camera captures data and writes it to its own buffer; the native buffer is copied to the managed buffer for the Dalvik VM; the buffer is written to disk; YUV is converted to RGB; RGB is displayed on the screen by loading data into a texture and rendering.
source share