本文介绍了SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用onPreviewFrame()回调显示过滤的相机预览。

I am trying to display a filtered camera preview, using onPreviewFrame() callback.

问题是,当我删除这行:
mHolder。 setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

The problem is that when i remove this line: mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

隐藏预览,应用程式崩溃。日志显示:
08-19 15:57:51.042:ERROR / CameraService(59):registerBuffers失败,状态为-38

to hide the preview, the app crashes. The log reads: 08-19 15:57:51.042: ERROR/CameraService(59): registerBuffers failed with status -38

这是什么意思?这是记录在任何地方吗?

What does this mean? Is this documented anywhere?

我使用SDK APIDemos的CameraPreview:

I am using the CameraPreview from the SDK APIDemos: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html

推荐答案

SURFACE_TYPE_PUSH_BUFFERS为SurfaceView生成多个缓冲区。组件在OS代码中锁定(填充数据)和推送(显示数据)这些缓冲区。特别是OpenMax(相机硬件设备接口)使用图形缓冲区=推送缓冲区来填充数据和显示数据。具体来说,摄像机硬件可以直接填充推送缓冲区,并且图形硬件可以直接显示推送缓冲区(它们共享这些缓冲区)。结论:操作系统强制您使用推送缓冲区创建SurfaceView。然后它可以使用缓冲区为相机设备。

SURFACE_TYPE_PUSH_BUFFERS generates several buffers for the SurfaceView. Components are locking (fill with data) and pushing (display data) these buffers deep in the OS code. Especially OpenMax (camera hardware device interface) is using "graphic buffers"="push buffers" to fill data and display data. To be specific, the camera hardware can fill a push buffer directly and die graphics hardware can display a push buffer directly (they share these buffers). Conclusion: The OS forces you to create a SurfaceView with push buffers. Then it can use the buffers for the camera device.

这篇关于SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 02:29