First off, my phone doesn't support the native camera, so I'm using the 2.4.0 equivalent of tutorial-0 tutorial-1(Add OpenCV) as an example.
I have built an activity with some ProgressBars, some TextViews, and a surface view with the captured image. The Progess bars and TextViews update fine, but the SurfaceView will stop updating. It won't start again until I open another activity and go back to my activity.
I don't know where to look for the problem, so I'm looking for debugging tips, or requests for more information.
LogCat Info:
In the beginning, things are working just fine. The surfaceView is created, normally. The frames are being processed. Then the surface gets created again, for some reason.
I/Sample1View.java( 2574): processFrame
I/Sample::SurfaceView( 2574): In While Loop (SampleViewBase::Run)
I/Sample::SurfaceView( 2574): surfaceCreated
Then there are some error messages from the camera?
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 290, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 290)
I/QualcommCameraHardwareZSL( 125): request capture mode normal
I/QualcommCameraHardwareZSL( 125): requested preview size 640 x 480
I/QualcommCameraHardwareZSL( 125): requested picture size 640 x 480, mCaptureMode 0
I/QualcommCameraHardwareZSL( 125): requested jpeg thumbnail size 512 x 384
I/QualcommCameraHardwareZSL( 125): requested jpeg quality 85
D/QualcommCameraHardwareZSL( 125): flip-video = 0
D/QualcommCameraHardwareZSL( 125): setZoom pre_value 0 value 0
I/QualcommCameraHardwareZSL( 125): Set zoom=0 40
I/QualcommCameraHardwareZSL( 125): request burst picture count 1
D/QualcommCameraHardwareZSL( 125): setSharpness pre_value 10 value 10
D/QualcommCameraHardwareZSL( 125): initDefaultParameters AfArea : (0,0,0,0,0)
D/QualcommCameraHardwareZSL( 125): initDefaultParameters AecArea : (0,0,0,0,0)
D/QualcommCameraHardwareZSL( 125): setAecLock pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setAwbLock pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setAntibanding pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setSceneMode pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): requested video size 640 x 480
D/QualcommCameraHardwareZSL( 125): virtual bool android::QualcommCameraHardware::recordingEnabled() recordingState=0
I/QualcommCameraHardwareZSL( 125): setRecordingHint value 0 actual-camera-mode 0 cam-mode -1 recordingEnabled 0
I/QualcommCameraHardwareZSL( 125): requested Fps Range min: 1 x max: 200000
D/mm-camera( 125): config_proc_CAMERA_SET_PARM_FPS: 18
D/QualcommCameraHardwareZSL( 125): setAutoExposure pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setExposureCompensation pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setISOValue pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setSaturation pre_value 5 value 5
I/QualcommCameraHardwareZSL( 125): requested effect 0
D/QualcommCameraHardwareZSL( 125): setEffect mColorEffectState 0
D/QualcommCameraHardwareZSL( 125): setEffect pre_value 0 value 0
D/QualcommCameraHardwareZSL( 125): setWhiteBalance pre_value 1 value 1
D/QualcommCameraHardwareZSL( 125): pre_mColorEffectState value = 0 mColorEffectState 0
D/QualcommCameraHardwareZSL( 125): setContrast pre_value 5 value 5
I/QualcommCameraHardwareZSL( 125): Setting flash 0
D/ ( 125): [GECameraParameters::getGPUEffect] enter
D/ ( 125): [GECameraParameters::getGPUEffect] leave. no key GPU-effect
D/ ( 125): [GECameraParameters::getGPUEffectParam] leave. no key GE-param0
D/ ( 125): [GECameraParameters::getGPUEffectParam] leave. no key GE-param1
I/GPUPostEffect( 125): int mlabs::GPUPostEffect::setParameters(mlabs::GPUPostEffect::GPUTask*): old effect = -1, new effect = -1.
D/GPUPostEffect( 125): setParameters: isGEInit == false: no call to ChooseEffect.
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 291, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 291)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 292, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 292)
D/QualcommCameraHardwareZSL( 125): previewEnabled() E, mZslEnable 0
D/QualcommCameraHardwareZSL( 125): previewEnabled() X, mCameraRunning=1 mPreviewStartInProgress=0
I/QualcommCamera( 125): int android::set_preview_window(camera_device*, preview_stream_ops*): E window = 0x18a52b8
I/QualcommCameraHardwareZSL( 125): setPreviewWindow: E, window 0x18a52b8, mPreviewWindow 0x18a52b8
D/QualcommCameraHardwareZSL( 125): setPreviewWindow: bufferInitialized 1 frameThreadRunning 1 mPreviewInitialized 1
I/QualcommCamera( 125): int android::set_preview_window(camera_device*, preview_stream_ops*): X
W/SurfaceTexture( 2574): freeAllBuffersExceptCurrentLocked called but mQueue is not empty
I/Sample1View.java( 2574): onPreviewStarted
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 293, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 293)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 294, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 294)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 295, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 295)
W/QualcommCameraHardwareZSL( 125): MemoryCacheFlush : fd 65 size 462848 PMEM_CACHE_FLUSH error Bad file number (9)
D/libgenlock( 125): Invalid gralloc handle (at 0x192b6c8): ver(26564352/12) ints(12/12) fds(26391736/2) magic(gmsm/gmsm)
E/libgenlock( 125): perform_lock_unlock_operation: handle is invalid
E/QualcommCameraHardwareZSL( 125): runPreviewThread: genlock_unlock_buffer failed
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: encountered NULL buffer in slot 0 looking for buffer 0x192b6c8
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 00: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 01: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 02: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 03: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 04: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 05: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 06: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 07: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 08: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 09: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 10: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 11: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 12: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 13: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 14: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 15: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 16: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 17: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 18: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 19: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 20: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 21: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 22: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 23: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 24: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 25: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 26: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 27: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 28: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 29: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 30: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 31: NULL
E/SurfaceTextureClient( 125): getSlotFromBufferLocked: unknown buffer: 0x192b6c8
W/QualcommCameraHardwareZSL( 125): runPreviewThread: Failed while queueing buffer 65 for display. Error = -22
E/memalloc( 125): /dev/pmem: Failed to map buffer size:16474112 offset:16470016 fd:63 Error: Invalid argument
E/msm8660.gralloc( 125): Could not mmap handle 0x1979130, fd=63 (Invalid argument)
E/msm8660.gralloc( 125): gralloc_register_buffer: gralloc_map failed
W/GraphicBufferMapper( 125): registerBuffer(0x1979130) failed -22 (Invalid argument)
E/libgenlock( 125): perform_lock_unlock_operation: GENLOCK_IOC_LOCK failed (lockType0x1, err=Not a typewriter fd=63)
E/QualcommCameraHardwareZSL( 125): runPreviewThread: genlock_lock_buffer(WRITE) failed
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 296, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 296)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 297, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 297)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 298, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 298)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 299, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 299)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 300, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 300)
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 301, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 301)
W/QualcommCameraHardwareZSL( 125): MemoryCacheFlush : fd 61 size 462848 PMEM_CACHE_FLUSH error Bad file number (9)
D/libgenlock( 125): Invalid gralloc handle (at 0x1955708): ver(1074918720/12) ints(12/12) fds(26392256/2) magic(gmsm/gmsm)
E/libgenlock( 125): perform_lock_unlock_operation: handle is invalid
E/QualcommCameraHardwareZSL( 125): runPreviewThread: genlock_unlock_buffer failed
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: encountered NULL buffer in slot 1 looking for buffer 0x1955708
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 00: 0x1979130
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 01: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 02: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 03: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 04: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 05: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 06: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 07: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 08: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 09: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 10: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 11: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 12: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 13: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 14: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 15: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 16: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 17: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 18: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 19: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 20: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 21: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 22: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 23: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 24: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 25: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 26: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 27: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 28: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 29: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 30: NULL
D/SurfaceTextureClient( 125): getSlotFromBufferLocked: 31: NULL
E/SurfaceTextureClient( 125): getSlotFromBufferLocked: unknown buffer: 0x1955708
W/QualcommCameraHardwareZSL( 125): runPreviewThread: Failed while queueing buffer 61 for display. Error = -22
E/SurfaceTexture( 2574): [unnamed-2574-3] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
E/QualcommCameraHardwareZSL( 125): runPreviewThread: Failed while dequeueing buffer from display. Error = -22
E/QualcommCameraHardwareZSL( 125): runPreviewThread: Could not find the Frame
I/CAMFRAME( 125): cam_frame: Preview frame dropped
D/dalvikvm( 2574): GC_FOR_ALLOC freed 854K, 47% free 6573K/12288K, paused 26ms
I/Sample::SurfaceView( 2574): In While Loop
I/CAMFRAME( 125): cam_frame: Preview frame dropped
W/SurfaceTexture( 2574): freeAllBuffersLocked called but mQueue is not empty
D/QualcommCameraHardwareZSL( 125): previewEnabled() E, mZslEnable 0
D/QualcommCameraHardwareZSL( 125): previewEnabled() X, mCameraRunning=1 mPreviewStartInProgress=0
I/Sample1View.java( 2574): processFrame
D/RPC ( 220): 3000008c:00050000 received CALL.
D/RPC ( 220): 3000008c:00050000 dispatching RPC call (XID 302, xdr 0x11e0a68) for callback client 3100008c:00050001.
D/RPC ( 220): 3100008c:327681 sending RPC reply (XID 302)
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/Sample1View.java( 2574): processFrame
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/Sample::SurfaceView( 2574): In While Loop
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/Sample::SurfaceView( 2574): In While Loop
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
D/MP-Decision( 702): DOWN Ns:2.100000 Ts:270 rq:1.100000 seq:297 (Up time:1549)
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/CAMFRAME( 125): cam_frame: Preview frame dropped
I/ODOK ( 2574): Looping
I/CAMFRAME( 125): cam_frame: Preview frame dropped
From then on, there's no more processFrame, just the Preview frame dropped. I'm not sure who's making those RPC messages, but I have a gps application running as a service at the same time.