Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: webrtc/api/java/android/org/webrtc/EglBase10.java

Issue 1848483002: Android EGL: Synchronize calls to eglSwapBuffers and eglMakeCurrent (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/java/android/org/webrtc/EglBase.java ('k') | webrtc/api/java/android/org/webrtc/EglBase14.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « webrtc/api/java/android/org/webrtc/EglBase.java ('k') | webrtc/api/java/android/org/webrtc/EglBase14.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698