本文介绍了Android的TextureView OpenGLRenderer:GL_INVALID_OPERATION的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个片段,有一个TextureView显示相机preVIEW或播放视频。

I have two fragments that has a TextureView to show camera preview or to play video.

使用的应用程序一段时间,与屏幕播放后,
我得到这个错误在logcat中

after using the app for a while, playing with the screens, i get this error in the logcat

OpenGLRenderer﹕ GL_INVALID_OPERATION

我释放一切从我的片段,
所有成员都设置为null。

i release everything from my fragments,all members are set to null.

@Override
public void onDestroyView() {
    Logg.DEBUG(TAG, "onDestroyView");
    super.onDestroyView();
    if (mMediaPlayer != null) {
        mMediaPlayer.stop();
        mMediaPlayer.release();
        mMediaPlayer = null;
    }

    nextButton = null;
    pauseButton = null;
    backButton = null;
    playButton = null;
    frontTextView = null;
    backTextView = null;
    surface = null;
    videoView = null;
}

和我看到整个视图变得怪异...

and i see the whole view become weird...

我想什么?

推荐答案

您的截图显示,当系统OpenGL上下文损坏/破损的情况。请你释放什么线程你resouces检查。 GLContext应该从那里被分配完全相同线程被销毁。你的情况可能是由错误的线程做setSurface / setDisplay电话。

Your screenshot shows situation when system OpenGL context is corrupted / broken. Please check on what thread you release your resouces. GLContext should be destroyed from exactly same thread where it was allocated. In your case it could be setSurface/setDisplay calls made from wrong thread.

如果你有稳定的和简单的步骤重现您可以尝试使用捕捉GL日志,但它减慢您的应用程序的很多拍摄期间

If you have stable and easy steps to reproduce you can try to capture GL log using Tracer for OpenGL ES, but its slows your application a lot during capturing

这篇关于Android的TextureView OpenGLRenderer:GL_INVALID_OPERATION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 14:34