EGL API19 fine, but >API 21 got error 3008

1.7k views Asked by At

Thank you for your reading!

I use the github project GLRecorder as a library and put it to my project for recording.

GLRecorder :https://github.com/lokii/GLRecorder

I could run it on my api 19 android phone.But I run it on api 21 to api 25, they all got crashing!

Error Info:

E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY) Process: com.example.chankim.vrcam, PID: 5812 java.lang.RuntimeException: eglCreateWindowSurface: EGL error: 0x3008 at com.research.GLRecorder.gles.EglCore.checkEglError(EglCore.java:209) at com.research.GLRecorder.gles.EglCore.createWindowSurface(EglCore.java:72) at com.research.GLRecorder.gles.EglSurfaceBase.createWindowSurface(EglSurfaceBase.java:64) at com.research.GLRecorder.gles.WindowSurface.(WindowSurface.java:41) at com.research.GLRecorder.GLRecorder.startEncoder(GLRecorder.java:234) at com.research.GLRecorder.GLRecorder.setRecordingEnabled(GLRecorder.java:147) at com.research.GLRecorder.GLRecorder.startRecording(GLRecorder.java:128) at com.example.chankim.vrcam.MainActivity.changeIcon(MainActivity.java:319) at com.example.chankim.vrcam.MainActivity$8.onClick(MainActivity.java:178) at android.view.View.performClick(View.java:5204) at android.view.View$PerformClick.run(View.java:21153) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

so how could I solve this?

2

There are 2 answers

0
Nino Liang On BEST ANSWER

I solved this!

It`s the problem about GL thread.

Use this code, it will run fine!

                mDrawView.queueEvent(new Runnable() {
                @Override
                public void run() {
                    GLRecorder.stopRecording();
                }});
0
Nino Liang On

I found my problem. In layout.xml,I defined a GLSurfaceView to put my image in.

If I used this code in main activity

    super.onCreate(savedInstanceState);
    mDrawView = new Draw(getApplication());
    setContentView(mDrawView);

App would run fine!

But if I used this code in main activity

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    findViewById(R.id.button_start).setOnClickListener(this);
    findViewById(R.id.button_end).setOnClickListener(this);
    mDrawView = (Draw)findViewById(R.id.mDraw2);

It will crash. So how to solve it?