在 Motorola Droid 上,固件 2.1-update1,内核 2.9.29-omap1,内部版本 #ESE81
尝试拍照时,mediaserver 因分段错误而死。
我尝试takePicture
在相机初始化后放置一个计时器并运行它几秒钟以检查竞争条件,但没有任何变化。只是调用Camera.open()
不会导致崩溃。此外,呼叫Camera.open()
会导致我认为是自动对焦电机发出一种滴答声。
破坏的代码:
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();
}
}
}
调试日志:
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