English 中文(简体)
Droid s mediaserver dies on camera.takePicture()
原标题:

On Motorola Droid, Firmware 2.1-update1, Kernel 2.9.29-omap1, Build # ESE81

When attempting to take a picture, mediaserver dies with a segmentation fault.

I ve tried putting takePicture in a timer and running it a few seconds after camera initialization to check for race conditions, but no change. Just calling Camera.open() doesn t cause the crash. Also, calling Camera.open() causes what I think is the autofocus motor to make a sort of ticking sound.

Code that breaks:

import android.app.Activity;
import android.os.Bundle;

public final class ChopperMain extends Activity {
    public void onCreate(Bundle savedInstanceState) {
    try {
        Camera camera = Camera.open();
        catch (Exception e) {
            e.printStackTrace();
        }
        camera.takePicture(
                new Camera.ShutterCallback() {
                    public void onShutter() {
                        ;
                    }
                }, 
                new Camera.PictureCallback() {
                    public void onPictureTaken(byte[] data, Camera camera) {
                        ;
                    }
                },
                new Camera.PictureCallback() {
                    public void onPictureTaken(byte[] data, Camera camera) {
                        ;
                    }
                },
            new PictureCallback() {
                public void onPictureTaken(byte[] data, Camera camera) {
                    System.out.println("Ta da.");
                }
            }
        });

    }
    catch (Exception e) {
        e.printStackTrace();
    }
    }
}

Debug Log:

D/CameraHal(10158): CameraSettings constructor
D/CameraHal(10158): CameraHal constructor
D/CameraHal(10158): Model ID: Droid
D/CameraHal(10158): Software ID 2.1-update1
D/dalvikvm(  988): GC freed 2 objects / 56 bytes in 215ms
D/ViewFlipper( 1074): updateRunning() mVisible=false, mStarted=true, mUserPresent=false, mRunning=false
I/HPAndroidHAL(10158): Version 2988.  Build Time: Oct 26 2009:11:21:55.
D/CameraHal(10158): 19 default parameters
D/CameraHal(10158): Immediate Zoom/1:0. Current zoom level/1:0
D/CameraHal(10158): CameraHal constructor exited ok
D/CameraService(10158): Client::Client X (pid 10400)
D/CameraService(10158): CameraService::connect X
D/CameraService(10158): takePicture (pid 10400)
I/DEBUG   (10159): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (10159): Build fingerprint:  verizon/voles/sholes/sholes:2.1-update1/ESE81/29593:user/release-keys 
I/DEBUG   (10159): pid: 10158, tid: 10158  >>> /system/bin/mediaserver <<<
I/DEBUG   (10159): signal 11 (SIGSEGV), fault addr 00000008
I/DEBUG   (10159):  r0 00000000  r1 00000000  r2 a969030c  r3 a9d1bfe0
I/DEBUG   (10159):  r4 00045eb0  r5 0000eb10  r6 000153a0  r7 a9c89fd2
I/DEBUG   (10159):  r8 00000000  r9 00000000  10 00000000  fp 00000000
I/DEBUG   (10159):  ip a969085c  sp bec4fba0  lr a9689c65  pc a9d1bfde  cpsr 60000030
I/DEBUG   (10159):          #00  pc 0001bfde  /system/lib/libutils.so
I/DEBUG   (10159):          #01  pc 00009c62  /system/lib/libcamera.so
I/DEBUG   (10159):          #02  pc 00007b0c  /system/lib/libcameraservice.so
I/DEBUG   (10159):          #03  pc 00021f98  /system/lib/libui.so
I/DEBUG   (10159):          #04  pc 00015514  /system/lib/libbinder.so
I/DEBUG   (10159):          #05  pc 00018dd8  /system/lib/libbinder.so
I/DEBUG   (10159):          #06  pc 00018fa6  /system/lib/libbinder.so
I/DEBUG   (10159):          #07  pc 000087d2  /system/bin/mediaserver
I/DEBUG   (10159):          #08  pc 0000c228  /system/lib/libc.so
I/DEBUG   (10159): 
I/DEBUG   (10159): code around pc:
I/DEBUG   (10159): a9d1bfcc bd1061e3 f7f3b510 bd10e97e 4d17b570 
I/DEBUG   (10159): a9d1bfdc 6886a300 460418ed fff4f7ff d10a4286 
I/DEBUG   (10159): a9d1bfec 46234913 20054a13 f06f1869 18aa040a 
I/DEBUG   (10159): 
I/DEBUG   (10159): code around lr:
I/DEBUG   (10159): a9689c54 e0240412 0204f8d0 050cf104 edf0f7fd 
I/DEBUG   (10159): a9689c64 f7fd4628 f8d4ecf2 b1533204 f852681a 
I/DEBUG   (10159): a9689c74 18581c0c 7101f504 ed82f7fd f8c42000 
I/DEBUG   (10159): 
I/DEBUG   (10159): stack:
I/DEBUG   (10159):     bec4fb60  4000902c  /dev/binder
I/DEBUG   (10159):     bec4fb64  a9d19675  /system/lib/libutils.so
I/DEBUG   (10159):     bec4fb68  00002bb4  
I/DEBUG   (10159):     bec4fb6c  a9d1b26f  /system/lib/libutils.so
I/DEBUG   (10159):     bec4fb70  bec4fbbc  [stack]
I/DEBUG   (10159):     bec4fb74  00095080  [heap]
I/DEBUG   (10159):     bec4fb78  a9c8c028  /system/lib/libcameraservice.so
I/DEBUG   (10159):     bec4fb7c  a9c8c028  /system/lib/libcameraservice.so
I/DEBUG   (10159):     bec4fb80  00015390  [heap]
I/DEBUG   (10159):     bec4fb84  a9c89fd2  /system/lib/libcameraservice.so
I/DEBUG   (10159):     bec4fb88  00045ebc  [heap]
I/DEBUG   (10159):     bec4fb8c  afe0f110  /system/lib/libc.so
I/DEBUG   (10159):     bec4fb90  00000000  
I/DEBUG   (10159):     bec4fb94  afe0f028  /system/lib/libc.so
I/DEBUG   (10159):     bec4fb98  df002777  
I/DEBUG   (10159):     bec4fb9c  e3a070ad  
I/DEBUG   (10159): #00 bec4fba0  00045eb0  [heap]
I/DEBUG   (10159):     bec4fba4  00045ebc  [heap]
I/DEBUG   (10159):     bec4fba8  000153a0  [heap]
I/DEBUG   (10159):     bec4fbac  a9689c65  /system/lib/libcamera.so
I/DEBUG   (10159): #01 bec4fbb0  a9c8c028  /system/lib/libcameraservice.so
I/DEBUG   (10159):     bec4fbb4  00015390  [heap]
I/DEBUG   (10159):     bec4fbb8  000153a0  [heap]
I/DEBUG   (10159):     bec4fbbc  a9c87b0f  /system/lib/libcameraservice.so
I/DEBUG   (10159): debuggerd committing suicide to free the zombie!
I/DEBUG   (10426): debuggerd: Mar 22 2010 17:31:05
W/MediaPlayer( 1021): MediaPlayer server died!
I/ServiceManager(  984): service  media.audio_flinger  died
I/ServiceManager(  984): service  media.player  died
I/ServiceManager(  984): service  media.camera  died
I/ServiceManager(  984): service  media.audio_policy  died
W/Camera  (10400): Camera server died!
W/Camera  (10400): ICamera died
E/Camera  (10400): Error 100
I/System.out(10400): Camera error, code 100
W/AudioSystem( 1021): AudioFlinger server died!
W/AudioSystem( 1021): AudioPolicyService server died!
I/        (10425): ServiceManager: 0xad08
E/AudioPostProcessor(10425): 
E/AudioPostProcessor(10425): AudioMgr Error:Failed to open gains file /data/ap_gain.bin
E/AudioPostProcessor(10425): 
E/AudioPostProcessor(10425): AudioMgr Error:Failed to  read gains/coeffs from /data 
E/AudioPostProcessor(10425): Audio coeffs init success. 
I/CameraService(10425): CameraService started: pid=10425
D/Audio_Unsolicited(10425): in readyToRun
D/Audio_Unsolicited(10425): Create socket successful 10 
I/AudioFlinger(10425): AudioFlinger s thread 0x11c30 ready to run
E/AudioService( 1021): Media server died.
E/AudioService( 1021): Media server started.
W/AudioPolicyManager(10425): setPhoneState() setting same state 0
最佳回答

You are missing most of the code necessary to work with a Camera. Here is a sample project that is more complete.

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签