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

Unified Diff: talk/app/webrtc/java/android/org/webrtc/EglBase.java

Issue 1342713003: Android: Add SurfaceTextureHelper for creating and managing SurfaceTextures (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Set eglBase.makeCurrent() once and for all in the ctor Created 5 years, 3 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 | « no previous file | talk/app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | talk/app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698