From 80c2cd973de7f3854451bde7bcefb564163bbd74 Mon Sep 17 00:00:00 2001 From: magjed Date: Tue, 15 Mar 2016 04:43:10 -0700 Subject: [PATCH] Android: Add more info for createPbufferSurface() exceptions This CL adds the width and height to the createPbufferSurface exception message. Also, when a Callable.call() fails in ThreadUtils.invokeUninterruptibly() we rethrow a new exception, but that excludes the callstack from Callable.call(). This CL adds the callstack from Callable.call() to make debugging easier. BUG=b/27581640,b/27516991 Review URL: https://codereview.webrtc.org/1780183005 Cr-Commit-Position: refs/heads/master@{#11996} --- webrtc/api/java/android/org/webrtc/EglBase10.java | 3 ++- webrtc/api/java/android/org/webrtc/EglBase14.java | 3 ++- webrtc/api/java/android/org/webrtc/ThreadUtils.java | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/webrtc/api/java/android/org/webrtc/EglBase10.java b/webrtc/api/java/android/org/webrtc/EglBase10.java index 6e20119e1b..fd3644f77a 100644 --- a/webrtc/api/java/android/org/webrtc/EglBase10.java +++ b/webrtc/api/java/android/org/webrtc/EglBase10.java @@ -158,7 +158,8 @@ final class EglBase10 extends EglBase { int[] surfaceAttribs = {EGL10.EGL_WIDTH, width, EGL10.EGL_HEIGHT, height, EGL10.EGL_NONE}; eglSurface = egl.eglCreatePbufferSurface(eglDisplay, eglConfig, surfaceAttribs); if (eglSurface == EGL10.EGL_NO_SURFACE) { - throw new RuntimeException("Failed to create pixel buffer surface"); + throw new RuntimeException( + "Failed to create pixel buffer surface with size: " + width + "x" + height); } } diff --git a/webrtc/api/java/android/org/webrtc/EglBase14.java b/webrtc/api/java/android/org/webrtc/EglBase14.java index 67551db51b..f23ca949e4 100644 --- a/webrtc/api/java/android/org/webrtc/EglBase14.java +++ b/webrtc/api/java/android/org/webrtc/EglBase14.java @@ -102,7 +102,8 @@ public final class EglBase14 extends EglBase { int[] surfaceAttribs = {EGL14.EGL_WIDTH, width, EGL14.EGL_HEIGHT, height, EGL14.EGL_NONE}; eglSurface = EGL14.eglCreatePbufferSurface(eglDisplay, eglConfig, surfaceAttribs, 0); if (eglSurface == EGL14.EGL_NO_SURFACE) { - throw new RuntimeException("Failed to create pixel buffer surface"); + throw new RuntimeException( + "Failed to create pixel buffer surface with size: " + width + "x" + height); } } diff --git a/webrtc/api/java/android/org/webrtc/ThreadUtils.java b/webrtc/api/java/android/org/webrtc/ThreadUtils.java index 68b52d3e15..8eeebc84dc 100644 --- a/webrtc/api/java/android/org/webrtc/ThreadUtils.java +++ b/webrtc/api/java/android/org/webrtc/ThreadUtils.java @@ -150,7 +150,10 @@ public class ThreadUtils { try { result.value = callable.call(); } catch (Exception e) { - throw new RuntimeException("Callable threw exception: " + e); + final RuntimeException runtimeException = + new RuntimeException("Callable threw exception: " + e); + runtimeException.setStackTrace(e.getStackTrace()); + throw runtimeException; } barrier.countDown(); }