Before takePicture, you must have called startPreview (without then
calling startPreview).

My picture taking code goes something like this:

cam.startPreview();
cam.takePicture();
cam.stopPreview();

According to the android docs, takePicture itself stops the preview,
but my experience is that I need to stop preview myself if I want to
be able to call takePicture again.

As a side note, you also cannot call takePicture again until the jpeg
callback from your current takePicture is called.

You can look at the source for the camera app that comes with Android
for an example that works consistently.

Bobby


On Apr 28, 7:18 am, Pavol Ban <zum...@gmail.com> wrote:
> Actually, here's more from the log.. this is the output right after
> autofocus is called, and before the output that i posted in the
> previous message.
>
> DEBUG/skia(824): purging 197K from font cache [28 entries]
> DEBUG/AUTOFOCUSING(824): hhh
> DEBUG/CameraService(798): autoFocus (pid 824)
> DEBUG/AUTOFOCUSING(824): hhh
> DEBUG/CameraService(798): autoFocus (pid 824)
> DEBUG/AUTOFOCUSING(824): hhh
> DEBUG/CameraService(798): autoFocus (pid 824)
> DEBUG/AUTOFOCUSING(824): hhh
> DEBUG/CameraService(798): autoFocus (pid 824)
> DEBUG/CameraService(798): stopPreview (pid 824)
> ERROR/mm-camera(798): liboemcamera: config_proc_ctrl_command: SEVERE
> ERROR: attempt to override pending command 38 with 13
> INFO/DEBUG(797): *** *** *** *** *** *** *** *** *** *** *** *** ***
> *** *** ***
> INFO/DEBUG(797): Build fingerprint: 'google/passion/passion/mahimahi:
> 2.1-update1/ERE27/24178:user/release-keys'
> INFO/DEBUG(797): pid: 798, tid: 833  >>> /system/bin/mediaserver <<<
> INFO/DEBUG(797): signal 11 (SIGSEGV), fault addr c0debadd
> INFO/DEBUG(797):  r0 deadbeef  r1 40606628  r2 21f66780  r3 21f66780
> INFO/DEBUG(797):  r4 40606ab4  r5 a94dec68  r6 00000000  r7 a94c8120
> INFO/DEBUG(797):  r8 00100000  r9 a940ab2d  10 40507000  fp 00000000
> INFO/DEBUG(797):  ip c0debadd  sp 40606a80  lr a940b019  pc a940b01e
> cpsr 60000030
> INFO/DEBUG(797):          #00  pc 0000b01e  /system/lib/
> liboemcamera.so
> INFO/DEBUG(797):          #01  pc 0000abce  /system/lib/
> liboemcamera.so
> INFO/DEBUG(797):          #02  pc 0000fd74  /system/lib/libc.so
> INFO/DEBUG(797):          #03  pc 0000f840  /system/lib/libc.so
> INFO/DEBUG(797): code around pc:
> INFO/DEBUG(797): a940b00c 200618fb e000f8cd ed5af7fe f8df482e
> INFO/DEBUG(797): a940b01c f8ccc0bc 88620000 570cf642 0014f112
> INFO/DEBUG(797): a940b02c fefef7fe 462551e8 cd0f4684 c70f4667
> INFO/DEBUG(797): code around lr:
> INFO/DEBUG(797): a940b008 18ba9001 200618fb e000f8cd ed5af7fe
> INFO/DEBUG(797): a940b018 f8df482e f8ccc0bc 88620000 570cf642
> INFO/DEBUG(797): a940b028 0014f112 fefef7fe 462551e8 cd0f4684
> INFO/DEBUG(797): stack:
> INFO/DEBUG(797):     40606a40  a94c8120  /system/lib/liboemcamera.so
> INFO/DEBUG(797):     40606a44  a9427f29  /system/lib/liboemcamera.so
> INFO/DEBUG(797):     40606a48  00000000
> .
> .
> .
> .
> .
> .
>
> On Apr 28, 1:54 pm, Pavol Ban <zum...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'm recieving a Camera Error 100 when calling
> > camera.takePicture(...);, along with Media Server and AudioFlinger
> > crashing.
>
> > My code is :
>
> > previewLayer.mCamera.autoFocus(new AutoFocusCallback() {
>
> >     @Override
> >     public void onAutoFocus(boolean success, Camera camera) {
> >         if (success) {
>
> >              previewLayer.mCamera.stopPreview();
>
> >              Camera.Parameters params = 
> > previewLayer.mCamera.getParameters();
> >              params.setPictureSize(1200, 1600);
> >              previewLayer.mCamera.setParameters(params);
>
> >              Log.d("TAKING PICTURE", "here");
> >                    camera.takePicture(null, null, callback);
> >         }
> >     }
>
> > });
>
> > and the app never enters the PictureCallback "callback". LogCat looks
> > something like this:
>
> > DEBUG/TAKING PICTURE(582): here
> > DEBUG/AUTOFOCUSING(582): here
> > WARN/AudioSystem(74): AudioFlinger server died!
> > WARN/AudioSystem(74): AudioPolicyService server died!
> > INFO/ServiceManager(47): service 'media.audio_flinger' died
> > INFO/ServiceManager(47): service 'media.player' died
> > INFO/ServiceManager(47): service 'media.camera' died
> > INFO/ServiceManager(47): service 'media.audio_policy' died
> > WARN/Camera(582): Camera server died!
> > WARN/Camera(582): ICamera died
> > ERROR/Camera(582): Error 100
> > INFO/DEBUG(436): debuggerd committing suicide to free the zombie!
> > INFO/DEBUG(597): debuggerd: Jan 27 2010 17:54:59
> > INFO/(598): ServiceManager: 0xad08
> > INFO/AudioHardwareQSD(598): open /system/etc/vpimg success
> > INFO/AudioHardwareQSD(598): Firmware /system/etc/vpimg size 26928
> > INFO/AudioHardwareQSD(598): Total 26928 bytes put to user space
> > buffer.
> > ERROR/AudioService(74): Media server died.
> > INFO/ServiceManager(74): Waiting for sevice media.audio_flinger...
> > INFO/ServiceManager(74): Waiting for sevice media.audio_flinger...
> > INFO/ServiceManager(74): Waiting for sevice media.audio_flinger...
> > INFO/AudioHardwareQSD(598): audience_a1026 init OK
> > INFO/HTC Acoustic(598): libhtc_acoustic.so version 2.0.1.2.
> > INFO/HTC Acoustic(598): open /system/etc/AdieHWCodecSetting.csv
> > success.
> > INFO/HTC Acoustic(598): ADIE table version: PASSION_HTC_20091019
> > ERROR/HTC Acoustic(598): Update ADIE table ID 0
> > ERROR/HTC Acoustic(598): Update ADIE table ID 2
> > ERROR/HTC Acoustic(598): Update ADIE table ID 5
> > ERROR/HTC Acoustic(598): Update ADIE table ID 7
> > ERROR/HTC Acoustic(598): Update ADIE table ID 8
> > ERROR/HTC Acoustic(598): Update ADIE table ID 10
> > ERROR/HTC Acoustic(598): Update ADIE table ID 51
> > ERROR/HTC Acoustic(598): Update ADIE table ID 53
> > INFO/HTC Acoustic(598): read_adie_para_from_file success.
> > DEBUG/HTC Acoustic(598): ioctl ACOUSTIC_UPDATE_ADIE success
> > INFO/HTC Acoustic(598): open /system/etc/AudioBTID.csv success.
> > INFO/HTC Acoustic(598): BT ID table version: PASSION_HTC_20091105
> > DEBUG/AudioHardwareQSD(598): mNumBTEndpoints = 24
> > ERROR/AudioHardwareQSD(598): BT name Default (tx,rx)=(1001,1101)
> > ERROR/AudioHardwareQSD(598): BT name Default Car-kit
> > (tx,rx)=(1002,1102)
> > ERROR/AudioHardwareQSD(598): BT name JKDAP3265 (tx,rx)=(1003,1103)
> > ERROR/AudioHardwareQSD(598): BT name JKDAP3264 (tx,rx)=(1004,1104)
> > ERROR/AudioHardwareQSD(598): BT name HTC BH M200 (tx,rx)=(1005,1105)
> > ERROR/AudioHardwareQSD(598): BT name BH M300 (tx,rx)=(1006,1106)
> > ERROR/AudioHardwareQSD(598): BT name Jabra BT530 (tx,rx)=(1007,1107)
> > ERROR/AudioHardwareQSD(598): BT name Jabra BT5010 (tx,rx)=(1008,1108)
> > ERROR/AudioHardwareQSD(598): BT name Jabra BT3030 (tx,rx)=(1009,1109)
> > ERROR/AudioHardwareQSD(598): BT name Nokia BH-208 (tx,rx)=(1010,1110)
> > ERROR/AudioHardwareQSD(598): BT name Nokia BH-703 (tx,rx)=(1011,1111)
> > ERROR/AudioHardwareQSD(598): BT name Nokia BH-103 (tx,rx)=(1012,1112)
> > ERROR/AudioHardwareQSD(598): BT name Samsung WEP410
> > (tx,rx)=(1013,1113)
> > ERROR/AudioHardwareQSD(598): BT name 3xxPlantronics
> > (tx,rx)=(1014,1114)
> > ERROR/AudioHardwareQSD(598): BT name 6XXPlantronics
> > (tx,rx)=(1015,1115)
> > ERROR/AudioHardwareQSD(598): BT name 8XXPlantronics
> > (tx,rx)=(1016,1116)
> > ERROR/AudioHardwareQSD(598): BT name Motorola H710 (tx,rx)=(1017,1117)
> > ERROR/AudioHardwareQSD(598): BT name Motorola H12 (tx,rx)=(1018,1118)
> > ERROR/AudioHardwareQSD(598): BT name Motorola S9 (tx,rx)=(1019,1119)
> > ERROR/AudioHardwareQSD(598): BT name HBH-IV840 (tx,rx)=(1020,1120)
> > ERROR/AudioHardwareQSD(598): BT name HBH-PV710 (tx,rx)=(1021,1121)
> > ERROR/AudioHardwareQSD(598): BT name HBH-DS220 (tx,rx)=(1022,1122)
> > ERROR/AudioHardwareQSD(598): BT name HBH-DS980 (tx,rx)=(1023,1123)
> > ERROR/AudioHardwareQSD(598): BT name Nexus One Car Dock
> > (tx,rx)=(1024,1124)
>
> > after this, the image on the screen freezes, as if it was taking the
> > picture, but never returns back to normal, since the code never
> > reaches the startpreview method call. The app doesn't crash, just
> > freezes itself in this position, and all i can do is hit back or home.
>
> > The same code works as it should on my G1, but does this on the N1. I
> > tried changing the image resolution and removing and commenting out
> > the stopPreview call, but it didn't help. Any ideas on how to fix
> > this?
>
> > Thank you!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to