Chromium Code Reviews

Unified Diff: webrtc/api/android/java/src/org/webrtc/EglBase10.java

Issue 2338033002: Android EglBase: Include EGL error code in exceptions (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | webrtc/api/android/java/src/org/webrtc/EglBase14.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/java/src/org/webrtc/EglBase10.java
diff --git a/webrtc/api/android/java/src/org/webrtc/EglBase10.java b/webrtc/api/android/java/src/org/webrtc/EglBase10.java
index af3266fc0c2268e712616c9ba061ac5b63fe8763..5ca429def47054656af0acf9f556a6c8f344699c 100644
--- a/webrtc/api/android/java/src/org/webrtc/EglBase10.java
+++ b/webrtc/api/android/java/src/org/webrtc/EglBase10.java
@@ -139,7 +139,8 @@ public final class EglBase10 extends EglBase {
int[] surfaceAttribs = {EGL10.EGL_NONE};
eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, nativeWindow, surfaceAttribs);
if (eglSurface == EGL10.EGL_NO_SURFACE) {
- throw new RuntimeException("Failed to create window surface");
+ throw new RuntimeException(
+ "Failed to create window surface: 0x" + Integer.toHexString(egl.eglGetError()));
}
}
@@ -159,7 +160,8 @@ public final class EglBase10 extends EglBase {
eglSurface = egl.eglCreatePbufferSurface(eglDisplay, eglConfig, surfaceAttribs);
if (eglSurface == EGL10.EGL_NO_SURFACE) {
throw new RuntimeException(
- "Failed to create pixel buffer surface with size: " + width + "x" + height);
+ "Failed to create pixel buffer surface with size " + width + "x" + height
+ + ": 0x" + Integer.toHexString(egl.eglGetError()));
}
}
@@ -222,7 +224,8 @@ public final class EglBase10 extends EglBase {
}
synchronized (EglBase.lock) {
if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
- throw new RuntimeException("eglMakeCurrent failed");
+ throw new RuntimeException(
+ "eglMakeCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
}
}
}
@@ -233,7 +236,8 @@ public final class EglBase10 extends EglBase {
synchronized (EglBase.lock) {
if (!egl.eglMakeCurrent(
eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT)) {
- throw new RuntimeException("eglDetachCurrent failed");
+ throw new RuntimeException(
+ "eglDetachCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
}
}
}
@@ -253,11 +257,13 @@ public final class EglBase10 extends EglBase {
private EGLDisplay getEglDisplay() {
EGLDisplay eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
- throw new RuntimeException("Unable to get EGL10 display");
+ throw new RuntimeException(
+ "Unable to get EGL10 display: 0x" + Integer.toHexString(egl.eglGetError()));
}
int[] version = new int[2];
if (!egl.eglInitialize(eglDisplay, version)) {
- throw new RuntimeException("Unable to initialize EGL10");
+ throw new RuntimeException(
+ "Unable to initialize EGL10: 0x" + Integer.toHexString(egl.eglGetError()));
}
return eglDisplay;
}
@@ -268,7 +274,8 @@ public final class EglBase10 extends EglBase {
int[] numConfigs = new int[1];
if (!egl.eglChooseConfig(
eglDisplay, configAttributes, configs, configs.length, numConfigs)) {
- throw new RuntimeException("eglChooseConfig failed");
+ throw new RuntimeException(
+ "eglChooseConfig failed: 0x" + Integer.toHexString(egl.eglGetError()));
}
if (numConfigs[0] <= 0) {
throw new RuntimeException("Unable to find any matching EGL config");
@@ -294,7 +301,8 @@ public final class EglBase10 extends EglBase {
eglContext = egl.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttributes);
}
if (eglContext == EGL10.EGL_NO_CONTEXT) {
- throw new RuntimeException("Failed to create EGL context");
+ throw new RuntimeException(
+ "Failed to create EGL context: 0x" + Integer.toHexString(egl.eglGetError()));
}
return eglContext;
}
« no previous file with comments | « no previous file | webrtc/api/android/java/src/org/webrtc/EglBase14.java » ('j') | no next file with comments »

Powered by Google App Engine