I’m testing my app using HTC Wildfire with Android 2.2.1.
The default camera preview size is 768×432. I see it from device log:
12-19 18:41:34.088: D/QualcommCameraHardware(72): initPreview E: preview size=768x432
12-19 18:41:34.088: D/QualcommCameraHardware(72): initPreview E: preview size=768x432 videosize = 768 x 432
12-19 18:41:34.088: D/QualcommCameraHardware(72): mBufferSize=497664, mAlignedBufferSize=524288
OK, it works. But if I try to change preview size to some different value like 320×240 or 800×480 there is nothing but a mess of pixels on the screen. The most interesting thing here is that if I use preview with the buffer size smaller then the default one (497664) I get this error in the log:
12-19 18:52:49.288: E/Camera-JNI(5776): Manually set buffer was too small! Expected 497664 bytes, but got 144000!
So it is obvious that the actual buffer size is not changed. Is there any way to solve this?
I should also notice that there is no such problem on Asus Eee Pad Transformer with Android 3.2.1
I’ve figured out what was the problem.
It appears that on Android 2.2.1 you do have to set camera parameters BEFORE you call
However on later systems like Android 3.2.1 this is no longer an issue (however it could be vendor specific).