Andoid EglBase: Detect failure to find EGL config

BUG=b/27950559

Review URL: https://codereview.webrtc.org/1855953002

Cr-Commit-Position: refs/heads/master@{#12239}
This commit is contained in:
magjed
2016-04-05 06:08:06 -07:00
committed by Commit bot
parent 0cf7b9c811
commit 9fdb6cf255
2 changed files with 16 additions and 2 deletions

View File

@ -268,9 +268,16 @@ final class EglBase10 extends EglBase {
int[] numConfigs = new int[1];
if (!egl.eglChooseConfig(
eglDisplay, configAttributes, configs, configs.length, numConfigs)) {
throw new RuntimeException("eglChooseConfig failed");
}
if (numConfigs[0] <= 0) {
throw new RuntimeException("Unable to find any matching EGL config");
}
return configs[0];
final EGLConfig eglConfig = configs[0];
if (eglConfig == null) {
throw new RuntimeException("eglChooseConfig returned null");
}
return eglConfig;
}
// Return an EGLConfig, or die trying.

View File

@ -228,9 +228,16 @@ public final class EglBase14 extends EglBase {
int[] numConfigs = new int[1];
if (!EGL14.eglChooseConfig(
eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) {
throw new RuntimeException("eglChooseConfig failed");
}
if (numConfigs[0] <= 0) {
throw new RuntimeException("Unable to find any matching EGL config");
}
return configs[0];
final EGLConfig eglConfig = configs[0];
if (eglConfig == null) {
throw new RuntimeException("eglChooseConfig returned null");
}
return eglConfig;
}
// Return an EGLConfig, or die trying.