有没有人知道会导致以下错误的原因?
queueBuffer:错误排队缓冲区到SurfaceTexture,-32
我在我的应用中使用了SurfaceTexture和android.hardware.Camera。当我尝试开始/停止预览并多次打开/关闭相机时,会出现上述错误。
以下是错误日志:
10-27 15:39:54.173 I/ActivityManager( 2329): Process com.google.process.gapps (pid 20050) (adj 1) has died.
10-27 15:39:54.213 E/SELinux (23446): [DEBUG] seapp_context_lookup: seinfoCategory = default
10-27 15:39:54.213 D/dalvikvm(23446): Process 23446 nice name: com.google.process.gapps
10-27 15:39:54.213 D/dalvikvm(23446): Extra Options: not specified
10-27 15:39:54.213 I/ActivityManager( 2329): Process com.google.android.gms (pid 23282) (adj 1) has died.
10-27 15:39:54.243 D/SecCameraCoreManager( 1888): disableMsgType: 0xffff
10-27 15:39:54.243 D/Camera_HAL( 1888): atom_disable_msg_type msg_type=0x0000ffff
10-27 15:39:54.243 D/SecCameraCoreManager( 1888): stopPreview
10-27 15:39:54.243 D/SecCameraCoreManager( 1888): virtual void android::SecCameraCoreManager::stopPreview():stop IT Policy checking thread
10-27 15:39:54.243 D/ShotSingle( 1888): stopPreview
10-27 15:39:54.243 D/Camera_HAL( 1888): atom_disable_msg_type msg_type=0x000003c2
10-27 15:39:54.243 V/ShotSingle( 1888): stopPreview(1)
10-27 15:39:54.243 D/Camera_HAL( 1888): atom_stop_preview
10-27 15:39:54.243 E/Surface ( 1888): queueBuffer: error queuing buffer to SurfaceTexture, -32
10-27 15:39:54.243 E/Camera_PreviewThread( 1888): Surface::queueBuffer returned error -32
答案 0 :(得分:2)
如果SurfaceTexture在尝试提供相机数据时会收集垃圾,就会发生这种情况。
确保您在应用中持续引用SurfaceTexture,而不仅仅是将其传递给相机实例并让它超出范围。
关闭时,请确保在销毁SurfaceTexture之前已经停止预览(通常这意味着在预览停止并且相机关闭之前不会将应用程序保持为暂停状态),并且在启动时确保SurfaceTexture在启动之前有效预览。