在Nexus 5 GLSurfaceView帧率问题 [英] GLSurfaceView framerate issues on Nexus 5

查看:784
本文介绍了在Nexus 5 GLSurfaceView帧率问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个示例应用程序(完整的源)的EN codeS摄像头有媒体codeC报同时显示它们放在GLSurfaceView。

I have an example application (full source) that encodes camera frames with MediaCodec while displaying them on a GLSurfaceView.

Systrace确认30绘图调用是由每一秒:

Systrace confirms 30 drawing calls are made each second:

然而,screenrecord记录( .MP4 ,的 YouTube的)显示了明显的帧率是相当低的。

However, a screenrecord recording (.mp4, YouTube) shows the apparent framerate to be considerably lower.

在简单地说,我的编码和放大器;显示循环执行以下操作:

In a nutshell, my encoding & display loop does the following:

  • 使媒体codeC的表面输入EGL上下文电流
  • 在画一个摄像头帧到媒体codeC EGL表面
  • 使GLSurfaceView EGL上下文电流
  • 绘制相同的摄像机架到GLSurfaceView

在一个Galaxy Nexus的LTE和Nexus 7(都与AOSP 4.4),应用程序的正常执行。到目前为止,只有Nexus的5经验绘制到屏幕上的帧的数量和帧的数量之间的这种差异明显...

On a Galaxy Nexus LTE and Nexus 7 (both with AOSP 4.4), the application performs as expected. So far only the Nexus 5 experiences this discrepancy between the number of frames drawn to the screen and the number of frames apparent...

我祈祷我不是疯了。

推荐答案

我是能够复制的行为,我GL向导办公室的队友想通了这个问题。

I was able to replicate the behavior, and my GL wizard office-mate figured out the problem.

基本上,EGL上下文之一未注意到,纹理内容发生了变化,所以它保持呈现较旧的数据。我们认为它变得偶尔更新,因为它有一组缓冲区,通过它的周期,所以最终还是重新使用你要找的缓冲区。

Basically, one of the EGL contexts isn't noticing that the texture contents have changed, so it keeps rendering older data. We think it's getting occasional updates because it has a set of buffers that it cycles through, so eventually it re-uses the buffer you're looking at.

我能够通过更新纹理渲染器类,改变这个解决我的code中的问题:

I was able to fix the problem in my code by updating the texture renderer class, changing this:

GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureID);

这样:

GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureID);

未绑定并重新绑定导致司机拿起合适的缓冲区。

The un-bind and re-bind causes the driver to pick up the right buffer.

这篇关于在Nexus 5 GLSurfaceView帧率问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆