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.annotation.TargetApi; | 13 import android.annotation.TargetApi; |
14 import android.graphics.SurfaceTexture; | 14 import android.graphics.SurfaceTexture; |
15 import android.opengl.EGL14; | 15 import android.opengl.EGL14; |
16 import android.opengl.EGLConfig; | 16 import android.opengl.EGLConfig; |
17 import android.opengl.EGLContext; | 17 import android.opengl.EGLContext; |
18 import android.opengl.EGLDisplay; | 18 import android.opengl.EGLDisplay; |
19 import android.opengl.EGLExt; | 19 import android.opengl.EGLExt; |
20 import android.opengl.EGLSurface; | 20 import android.opengl.EGLSurface; |
21 import android.view.Surface; | 21 import android.view.Surface; |
22 | 22 |
23 /** | 23 /** |
24 * Holds EGL state and utility methods for handling an EGL14 EGLContext, an EGLD
isplay, | 24 * Holds EGL state and utility methods for handling an EGL14 EGLContext, an EGLD
isplay, |
25 * and an EGLSurface. | 25 * and an EGLSurface. |
26 */ | 26 */ |
27 @TargetApi(18) | 27 @TargetApi(18) |
28 class EglBase14 implements EglBase { | 28 class EglBase14 extends EglBase { |
29 private static final String TAG = "EglBase14"; | 29 private static final String TAG = "EglBase14"; |
30 private static final int EGLExt_SDK_VERSION = android.os.Build.VERSION_CODES.J
ELLY_BEAN_MR2; | 30 private static final int EGLExt_SDK_VERSION = android.os.Build.VERSION_CODES.J
ELLY_BEAN_MR2; |
31 private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_IN
T; | 31 private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_IN
T; |
32 private EGLContext eglContext; | 32 private EGLContext eglContext; |
33 private EGLConfig eglConfig; | 33 private EGLConfig eglConfig; |
34 private EGLDisplay eglDisplay; | 34 private EGLDisplay eglDisplay; |
35 private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; | 35 private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; |
36 | 36 |
37 // EGL 1.4 is supported from API 17. But EGLExt that is used for setting prese
ntation | 37 // EGL 1.4 is supported from API 17. But EGLExt that is used for setting prese
ntation |
38 // time stamp on a surface is supported from 18 so we require 18. | 38 // time stamp on a surface is supported from 18 so we require 18. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 synchronized (EglBase.lock) { | 257 synchronized (EglBase.lock) { |
258 eglContext = EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, co
ntextAttributes, 0); | 258 eglContext = EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, co
ntextAttributes, 0); |
259 } | 259 } |
260 if (eglContext == EGL14.EGL_NO_CONTEXT) { | 260 if (eglContext == EGL14.EGL_NO_CONTEXT) { |
261 throw new RuntimeException( | 261 throw new RuntimeException( |
262 "Failed to create EGL context: 0x" + Integer.toHexString(EGL14.eglGetE
rror())); | 262 "Failed to create EGL context: 0x" + Integer.toHexString(EGL14.eglGetE
rror())); |
263 } | 263 } |
264 return eglContext; | 264 return eglContext; |
265 } | 265 } |
266 } | 266 } |
OLD | NEW |