Trying to get camera working from native code in Android ICS: most manuals refer to startPreview() method . But browsing AOSP code I\'ve found also \'st
dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& data)
when
msgType==CAMERA_MSG_VIDEO_FRAME
gives data in internal form. It is not guaranteed pure yuv frame data. For example data.get()->size()
can be bigger than yuv frame size or can be some 20-bytes-sized data structure for real(?) frame buffer keeping somewhere in camera buffers list.
So, this topic is not complete yet. :)
to close topic: I was able to reach 1280x720 with FPS=30 using native access to camera and use hardware H264 encoder. Also can modify (watermark) data on the fly keeping FPS high. None of other approaches - any JAVA or OpenCV could give more that 15 FPS (may be I did not try hard..)
startRecording() works perfectly
thank you for comments
In terms of performance there is no gain in going for native camera. Using Camera.setPreviewCallbackWithBuffer() in Java (off UI thread) gives as many frames per second as any native alternative. But on some SOCs, e.g. Samsung, camera output may be directly (0-copy) wired with HW h264 encoder, which naturally gives excellent throughput. This is what the <quote>pure java MediaRecorder</quote> does under the hood. You cannot achieve same if any manipulation of the buffer should be involved.