| Index: talk/app/webrtc/java/android/org/webrtc/EglBase.java
|
| diff --git a/talk/app/webrtc/java/android/org/webrtc/EglBase.java b/talk/app/webrtc/java/android/org/webrtc/EglBase.java
|
| index 8d2c808cb256c5239d638ed5b6206b370d70cad9..20af8ecc75587cd80dfc8dd7f152a326e0e0a86e 100644
|
| --- a/talk/app/webrtc/java/android/org/webrtc/EglBase.java
|
| +++ b/talk/app/webrtc/java/android/org/webrtc/EglBase.java
|
| @@ -156,9 +156,7 @@ public final class EglBase {
|
| public void release() {
|
| checkIsNotReleased();
|
| releaseSurface();
|
| - // Release our context.
|
| - EGL14.eglMakeCurrent(
|
| - eglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
|
| + detachCurrent();
|
| EGL14.eglDestroyContext(eglDisplay, eglContext);
|
| EGL14.eglReleaseThread();
|
| EGL14.eglTerminate(eglDisplay);
|
| @@ -177,6 +175,14 @@ public final class EglBase {
|
| }
|
| }
|
|
|
| + // Detach the current EGL context, so that it can be made current on another thread.
|
| + public void detachCurrent() {
|
| + if (!EGL14.eglMakeCurrent(
|
| + eglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT)) {
|
| + throw new RuntimeException("eglMakeCurrent failed");
|
| + }
|
| + }
|
| +
|
| public void swapBuffers() {
|
| checkIsNotReleased();
|
| if (eglSurface == EGL14.EGL_NO_SURFACE) {
|
|
|