Camera causing crash

by blindfold » Sat, 25 Oct 2008 03:22:48 GMT

Sponsored Links
 In running my camera-based app on a real G1, the following debug
output showed up for a JPEG takePicture call:

E/QualcommCameraHardware(22797): QualcommCameraHardware::camera_cb:
E/QualcommCameraHardware(22797): camera cb: invalid state QCS_ERROR
for taking a picture!
D/CameraService(22797): postRaw
E/Camera  (22811): Error 1
D/CameraService(22797): postJpeg
D/AndroidRuntime(22811): Shutting down VM
W/dalvikvm(22811): threadid=3: thread exiting with uncaught exception
E/AndroidRuntime(22811): Uncaught handler: thread main exiting due to
uncaught exception

What does this mean? Is it because of a camera resolution mismatch?
(The Android API still offers no means to query for supported camera
resolutions!) Preview is running, and the app runs fine on the SDK 1.0
r1 emulator. What are the possible causes? I do not have a G1 myself
so I cannot test every possible combination and play divide and



Camera causing crash

by blindfold » Sat, 25 Oct 2008 05:45:08 GMT

 Oops, meant 3.1 megapixel, of course.


Sponsored Links

Camera causing crash

by blindfold » Sat, 25 Oct 2008 05:46:44 GMT

 Further tests suggest that the camera crash was caused by not
capturing in G1's native 2048 x 1536 (1.3 megapixel) resolution.
However, for me 1.3 MP is terrible overkill and causing
OutOfMemoryError errors in doing image processing on the physical G1.
What are the supported camera resolutions on the T-Mobile G1? Then I
can at least temporarily hard-code a lower resolution until a
forthcoming SDK 1.x finally adds the necessary APIs for querying
supported camera resolutions (as required once more Android phones,
with different cameras, hit the market). Right now I find the Android
SDK 1.0 r1 camera support too poor for serious use.


Camera causing crash

by blindfold » Sat, 25 Oct 2008 06:02:49 GMT

 I urgently need to know the *lowest* still image resolution supported
by the T-Mobile G1. Is it for instance 640 x 480 (VGA)?


Camera causing crash

by [EMAIL PROTECTED] » Sat, 25 Oct 2008 06:59:17 GMT

 I don't know if it's the case, but it's possible the camera ONLY
captures at full resolution and to get lower resolution you're
intended to use the image manipulation APIs... someone will need to
confirm this however


Camera causing crash

by blindfold » Sat, 25 Oct 2008 16:06:54 GMT

 That's what I'm afraid of, that the G1 can only capture at full
resolution. I do use image manipulation APIs for downscaling whenever
possible, but that initial G1 hi-res snapshot presents the bottleneck
in performance and memory (failure with OutOfMemoryError on the real
G1). I hope that the Android Team can at very short notice specify the
unspecified G1 camera properties, since required APIs for querying
supported camera resolutions are missing in SDK 1.0 r1. Furthermore, I
would normally be decoding a low-res preview image instead, but the
SDK 1.0 r1 APIs do not support decoding of the (again unspecified)
preview format, while the preview cannot even be properly positioned
and sized on the screen due to, again, incomplete APIs (let alone
their implementation).

I'm close to being forced to give up on Google Android because of its
immaturity in media processing (in my case camera input, audio
output). Moreover, it is very frustrating to have no indication
whatsoever when the various problems will be fixed. My equivalent
application for Java ME runs fine on almost all modern Nokia (S60)
camera phones (plus some other brands), so I am not talking about any
unrealistic goals here but just talking about fixing what is broken or
missing in Google Android and its implementation on the T-Mobile G1.


On Oct 25, 12:58am, "[EMAIL PROTECTED]"


Camera causing crash

by jrpowers » Sun, 02 Nov 2008 02:50:22 GMT

 You can grab a 480x320 picture, but it still takes a while to come
back after you call takePicture.

The preview format is some YUV format.  I think it's like YUV420P.
I've been able to decode the luminance part (Y) (it's just in-order
byte values), but I haven't tried to recover the color part.


Camera causing crash

by blindfold » Sun, 02 Nov 2008 04:11:35 GMT

 > You can grab a 480x320 picture, but it still takes a while to come

Thanks! Is this 480x320 for the physical G1, or for the emulator?

It is yuv422sp, which is equivalent to Android's YCbCr_422_SP.

I've now done both, being forced to because the still image capture
was a near guarantee for OutOfMemoryError crashes, but it requires a
bit of reverse engineering. The SDK 1.0 r1 emulator only displays the
Y part, but the preview data also contains the color information for
the moving colored rectangle.


Camera causing crash

by Jason Proctor » Tue, 04 Nov 2008 02:11:08 GMT

 >It is yuv422sp, which is equivalent to Android's YCbCr_422_SP.

on the G1, Camera claims the preview format is number 16, 
YCbCr_422_SP, but it isn't. it's YCbCr, but in 411 format. hence 
smaller relative frame size than the emulator. it's close to YUV 
411p, but the colour transform function is different for YUV than it 
is for YCbCr. in YUV the colour portion is absolute, whereas in YCbCr 
it's a correction from green.

(i'm no expert, so feel free to correct any of the above!)

this is interesting because i *think* i'm only getting b&w preview 
data on the emulator *and* the G1.

on the emulator, i get straight-up b&w regardless of whether i add in 
the UV component. which makes sense, because the Y component is 

on the G1, in my yuv411p decoder, if i leave out the CbCr portion, i 
get big time green, which is right. if i put them back in, i get a 
greyscale image, correcting the green. this makes sense, but i'm 
wondering why i'm not getting the colour i'm seeing on the screen.

btw my G1 might be broken. the camera always displays previews in the 
wrong orientation. in portrait, i have to turn my head 90deg to see 
the image upright. in landscape, i can hold the camera in portrait 
and see the image fine. other G1s here don't have this problem...


Camera causing crash

by blindfold » Tue, 04 Nov 2008 07:47:57 GMT

 Thanks Jason! It came as a big surprise to me that the G1 uses 411
instead of the emulator's sole 422 format. That is most welcome
information that is not publicly documented anywhere as far as I know,
making it a recipe for misery in camera-based image processing. If you
run my app on the emulator and press key "g" for the green filter (my
default decoding is in grayscale to save CPU time), then you will see
that it shows a color preview where the SDK 1.0 r1's built-in emulator
only shows the Y (grayscale) component. Of course further work is now
needed to also decode the G1's 411 format (my app still assumes 422).
I must conclude that camera support with Android is currently too
immature for serious and sustainable work.


Camera causing crash

by Jason Proctor » Tue, 04 Nov 2008 08:39:13 GMT

 others agree with your conclusion and are even pulling their apps 
from the market until there is a fix. i'm not spending any 
significant time with it until something happens, either.


Other Threads

1. Query about Content Provider queries...

I have one quick question and one maybe not-as-quick question:

1. Will we be able to employ more robust SQL(ite) queries on content
providers with future releases? For instance: joins, distinct, count,
max, etc?

2. Why isn't this possible now? I understand the concept of DB table
abstraction and the reasoning behind it, but why not still provide
some roundabout way of doing these operations (without storing the
content in a local SQLite table, of course)?

Thanks AT


2. Is it possible to get incoming caller id (phone number) in real time ?

Yes, its possible you have to either use a BroadcastReceiver or a
Service and listen to PHONE_STATE.
There is a lot of example here in the groups and forums like

You might find this helpful. Look at the onCallStateChanged, there is
a incomingNumber argument




4. spurious WAKE_LOCK SecurityException?

5. if size of image is larger than or smaller than specified display size

6. Queries regarding media support for Android.

7. Google Map Key