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

Side by Side Diff: webrtc/api/java/android/org/webrtc/EglBase14.java

Issue 1855953002: Andoid EglBase: Detect failure to find EGL config (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Switch to more fine grained exceptions Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/java/android/org/webrtc/EglBase10.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 return eglDisplay; 222 return eglDisplay;
223 } 223 }
224 224
225 // Return an EGLConfig, or die trying. 225 // Return an EGLConfig, or die trying.
226 private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttri butes) { 226 private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttri butes) {
227 EGLConfig[] configs = new EGLConfig[1]; 227 EGLConfig[] configs = new EGLConfig[1];
228 int[] numConfigs = new int[1]; 228 int[] numConfigs = new int[1];
229 if (!EGL14.eglChooseConfig( 229 if (!EGL14.eglChooseConfig(
230 eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) { 230 eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) {
231 throw new RuntimeException("eglChooseConfig failed");
232 }
233 if (numConfigs[0] <= 0) {
231 throw new RuntimeException("Unable to find any matching EGL config"); 234 throw new RuntimeException("Unable to find any matching EGL config");
232 } 235 }
233 return configs[0]; 236 final EGLConfig eglConfig = configs[0];
237 if (eglConfig == null) {
238 throw new RuntimeException("eglChooseConfig returned null");
239 }
240 return eglConfig;
234 } 241 }
235 242
236 // Return an EGLConfig, or die trying. 243 // Return an EGLConfig, or die trying.
237 private static EGLContext createEglContext( 244 private static EGLContext createEglContext(
238 EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfi g) { 245 EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfi g) {
239 if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONT EXT) { 246 if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONT EXT) {
240 throw new RuntimeException("Invalid sharedContext"); 247 throw new RuntimeException("Invalid sharedContext");
241 } 248 }
242 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO NE}; 249 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO NE};
243 EGLContext rootContext = 250 EGLContext rootContext =
244 sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Contex t; 251 sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Contex t;
245 EGLContext eglContext = 252 EGLContext eglContext =
246 EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttrib utes, 0); 253 EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttrib utes, 0);
247 if (eglContext == EGL14.EGL_NO_CONTEXT) { 254 if (eglContext == EGL14.EGL_NO_CONTEXT) {
248 throw new RuntimeException("Failed to create EGL context"); 255 throw new RuntimeException("Failed to create EGL context");
249 } 256 }
250 return eglContext; 257 return eglContext;
251 } 258 }
252 } 259 }
OLDNEW
« no previous file with comments | « webrtc/api/java/android/org/webrtc/EglBase10.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698