OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 package org.webrtc; | 11 package org.webrtc; |
12 | 12 |
13 import android.graphics.SurfaceTexture; | 13 import android.graphics.SurfaceTexture; |
14 import android.view.Surface; | 14 import android.view.Surface; |
15 | 15 |
16 import javax.microedition.khronos.egl.EGL10; | 16 import javax.microedition.khronos.egl.EGL10; |
17 | 17 |
18 | 18 |
19 /** | 19 /** |
20 * Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EG
LDisplay, | 20 * Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EG
LDisplay, |
21 * and an EGLSurface. | 21 * and an EGLSurface. |
22 */ | 22 */ |
23 public abstract class EglBase { | 23 public abstract class EglBase { |
24 // EGL wrapper for an actual EGLContext. | 24 // EGL wrapper for an actual EGLContext. |
25 public static class Context { | 25 public static class Context { |
26 } | 26 } |
27 | 27 |
| 28 // According to the documentation, EGL can be used from multiple threads at th
e same time if each |
| 29 // thread has its own EGLContext, but in practice it deadlocks on some devices
when doing this. |
| 30 // Therefore, synchronize on this global lock before calling dangerous EGL fun
ctions that might |
| 31 // deadlock. See https://bugs.chromium.org/p/webrtc/issues/detail?id=5702 for
more info. |
| 32 public static final Object lock = new Object(); |
| 33 |
28 // These constants are taken from EGL14.EGL_OPENGL_ES2_BIT and EGL14.EGL_CONTE
XT_CLIENT_VERSION. | 34 // These constants are taken from EGL14.EGL_OPENGL_ES2_BIT and EGL14.EGL_CONTE
XT_CLIENT_VERSION. |
29 // https://android.googlesource.com/platform/frameworks/base/+/master/opengl/j
ava/android/opengl/EGL14.java | 35 // https://android.googlesource.com/platform/frameworks/base/+/master/opengl/j
ava/android/opengl/EGL14.java |
30 // This is similar to how GlSurfaceView does: | 36 // This is similar to how GlSurfaceView does: |
31 // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.androi
d/android/5.1.1_r1/android/opengl/GLSurfaceView.java#760 | 37 // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.androi
d/android/5.1.1_r1/android/opengl/GLSurfaceView.java#760 |
32 private static final int EGL_OPENGL_ES2_BIT = 4; | 38 private static final int EGL_OPENGL_ES2_BIT = 4; |
33 // Android-specific extension. | 39 // Android-specific extension. |
34 private static final int EGL_RECORDABLE_ANDROID = 0x3142; | 40 private static final int EGL_RECORDABLE_ANDROID = 0x3142; |
35 | 41 |
36 public static final int[] CONFIG_PLAIN = { | 42 public static final int[] CONFIG_PLAIN = { |
37 EGL10.EGL_RED_SIZE, 8, | 43 EGL10.EGL_RED_SIZE, 8, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 119 |
114 public abstract void release(); | 120 public abstract void release(); |
115 | 121 |
116 public abstract void makeCurrent(); | 122 public abstract void makeCurrent(); |
117 | 123 |
118 // Detach the current EGL context, so that it can be made current on another t
hread. | 124 // Detach the current EGL context, so that it can be made current on another t
hread. |
119 public abstract void detachCurrent(); | 125 public abstract void detachCurrent(); |
120 | 126 |
121 public abstract void swapBuffers(); | 127 public abstract void swapBuffers(); |
122 } | 128 } |
OLD | NEW |