安卓相机错误-将缓冲区排队到SurfaceTexture时出错,-32



有人知道是什么导致了下面的错误吗?

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

如果您的SurfaceTexture在尝试向其提供相机数据时被垃圾收集,就会发生这种情况。

确保您在应用程序中保留对SurfaceTexture的引用,而不仅仅是将其传递给相机实例并让其超出范围。

关闭时,请确保在销毁SurfaceTexture之前已停止预览(通常这意味着在停止预览并关闭相机之前,不要离开应用程序的onPause),启动时,请在开始预览之前确保SurfaceTexture有效。

最新更新