| Index: webrtc/api/java/android/org/webrtc/EglBase10.java
|
| diff --git a/webrtc/api/java/android/org/webrtc/EglBase10.java b/webrtc/api/java/android/org/webrtc/EglBase10.java
|
| index fd3644f77acac921b33602240d9ec3441335c29f..fe2b73ee1cc2a542fbe8d5da6188d6609f7996ba 100644
|
| --- a/webrtc/api/java/android/org/webrtc/EglBase10.java
|
| +++ b/webrtc/api/java/android/org/webrtc/EglBase10.java
|
| @@ -220,17 +220,21 @@ final class EglBase10 extends EglBase {
|
| if (eglSurface == EGL10.EGL_NO_SURFACE) {
|
| throw new RuntimeException("No EGLSurface - can't make current");
|
| }
|
| - if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
|
| - throw new RuntimeException("eglMakeCurrent failed");
|
| + synchronized (EglBase.lock) {
|
| + if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
|
| + throw new RuntimeException("eglMakeCurrent failed");
|
| + }
|
| }
|
| }
|
|
|
| // Detach the current EGL context, so that it can be made current on another thread.
|
| @Override
|
| public void detachCurrent() {
|
| - if (!egl.eglMakeCurrent(
|
| - eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT)) {
|
| - throw new RuntimeException("eglMakeCurrent failed");
|
| + synchronized (EglBase.lock) {
|
| + if (!egl.eglMakeCurrent(
|
| + eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT)) {
|
| + throw new RuntimeException("eglDetachCurrent failed");
|
| + }
|
| }
|
| }
|
|
|
| @@ -240,7 +244,9 @@ final class EglBase10 extends EglBase {
|
| if (eglSurface == EGL10.EGL_NO_SURFACE) {
|
| throw new RuntimeException("No EGLSurface - can't swap buffers");
|
| }
|
| - egl.eglSwapBuffers(eglDisplay, eglSurface);
|
| + synchronized (EglBase.lock) {
|
| + egl.eglSwapBuffers(eglDisplay, eglSurface);
|
| + }
|
| }
|
|
|
| // Return an EGLDisplay, or die trying.
|
|
|