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

Side by Side Diff: webrtc/api/java/android/org/webrtc/EglBase10.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 | « no previous file | webrtc/api/java/android/org/webrtc/EglBase14.java » ('j') | 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 return eglDisplay; 262 return eglDisplay;
263 } 263 }
264 264
265 // Return an EGLConfig, or die trying. 265 // Return an EGLConfig, or die trying.
266 private EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) { 266 private EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
267 EGLConfig[] configs = new EGLConfig[1]; 267 EGLConfig[] configs = new EGLConfig[1];
268 int[] numConfigs = new int[1]; 268 int[] numConfigs = new int[1];
269 if (!egl.eglChooseConfig( 269 if (!egl.eglChooseConfig(
270 eglDisplay, configAttributes, configs, configs.length, numConfigs)) { 270 eglDisplay, configAttributes, configs, configs.length, numConfigs)) {
271 throw new RuntimeException("eglChooseConfig failed");
272 }
273 if (numConfigs[0] <= 0) {
271 throw new RuntimeException("Unable to find any matching EGL config"); 274 throw new RuntimeException("Unable to find any matching EGL config");
272 } 275 }
273 return configs[0]; 276 final EGLConfig eglConfig = configs[0];
277 if (eglConfig == null) {
278 throw new RuntimeException("eglChooseConfig returned null");
279 }
280 return eglConfig;
274 } 281 }
275 282
276 // Return an EGLConfig, or die trying. 283 // Return an EGLConfig, or die trying.
277 private EGLContext createEglContext( 284 private EGLContext createEglContext(
278 Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { 285 Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) {
279 if (sharedContext != null && sharedContext.eglContext == EGL10.EGL_NO_CONTEX T) { 286 if (sharedContext != null && sharedContext.eglContext == EGL10.EGL_NO_CONTEX T) {
280 throw new RuntimeException("Invalid sharedContext"); 287 throw new RuntimeException("Invalid sharedContext");
281 } 288 }
282 int[] contextAttributes = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE}; 289 int[] contextAttributes = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
283 EGLContext rootContext = 290 EGLContext rootContext =
284 sharedContext == null ? EGL10.EGL_NO_CONTEXT : sharedContext.eglContext; 291 sharedContext == null ? EGL10.EGL_NO_CONTEXT : sharedContext.eglContext;
285 EGLContext eglContext = 292 EGLContext eglContext =
286 egl.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttribut es); 293 egl.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttribut es);
287 if (eglContext == EGL10.EGL_NO_CONTEXT) { 294 if (eglContext == EGL10.EGL_NO_CONTEXT) {
288 throw new RuntimeException("Failed to create EGL context"); 295 throw new RuntimeException("Failed to create EGL context");
289 } 296 }
290 return eglContext; 297 return eglContext;
291 } 298 }
292 } 299 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/java/android/org/webrtc/EglBase14.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698