本文介绍了如何理解setDisplay / setSurface /套prewviewDisplay /套previewTexture对Android平台的下方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于Android的API级别1,我们可以附加一个MediaPlayer的或照相机与setDisplay表面或者设置prewviewDisplay,那么图像数据可以被转移到GPU和处理速度更快。

Since Android api level 1, We can attach a MediaPlayer or Camera to the Surface with setDisplay or setPrewviewDisplay, then image data can be transfered to gpu and processed much faster.

在表面纹理推出后,我们可以与目标GL_TEXTURE_EXTERNAL_OES创造自己的质地和MediaPlayer的或相机安装OpenGL ES的。

After SurfaceTexture is introduced, We can create our own texture with the target GL_TEXTURE_EXTERNAL_OES and attach the MediaPlayer or Camera to opengl es.

这是众所周知的,但我想谈的是这是关于Android图形架构的下方。(的)

These are well known, but what I want to talk about is the underneath which is about Android graphics architecture.(Android Graphics architecture)

产生的数据是在CPU方面,所以它必须在一个非常快速的方式被转移到GPU。

为什么每一个Android设备传输数据如此之快,以及如何使在它之下?

或者,这是没有任何与And​​roid硬件问题?

Or is this a hardware issue which has nothing to do with Android?

推荐答案

中的数据不会在CPU侧产生。相机和硬件视频codeCS店它们在内核gralloc机制分配的缓冲区数据(通过本次非公开GraphicBuffer从本地code引用)。表面经过BufferQueue对象,通过左右手柄通过帧沟通,而不复制数据本身。

The data is not produced on the CPU side. The camera and hardware video codecs store their data in buffers allocated by the kernel gralloc mechanism (referenced from native code through the non-public GraphicBuffer). Surfaces communicate through BufferQueue objects, which pass the frames around by handle, without copying the data itself.

这是到OEM,以确保摄像头,视频codeCS和GPU可以使用常见的格式。由视频codeC的输出YUV必须的东西,在实施GLES可以处理作为外部质感。这也是为什么 EGL_RECORDABLE_ANDROID 发送GLES渲染到媒体codeC ...需要让EGL实施知道它的渲染帧必须是辨认时需要视频codeC。

It's up to the OEM to ensure that the camera, video codecs, and GPU can use common formats. The YUV output by the video codec must be something that the GLES implementation can handle as an external texture. This is also why EGL_RECORDABLE_ANDROID is needed when sending GLES rendering to a MediaCodec... need to let the EGL implementation know that the frame it's rendering must be recognizable by the video codec.

这篇关于如何理解setDisplay / setSurface /套prewviewDisplay /套previewTexture对Android平台的下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 13:31