From cf7c58458e1ff5ae0d3e19678b9010f43edf3549 Mon Sep 17 00:00:00 2001 From: Paulina Hensman Date: Thu, 28 Feb 2019 14:27:28 +0100 Subject: [PATCH] Only draw frames with height and width >0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There has been some crashes due to frames having illegal sizes, most likely 0x0. Probably these frames are created as a workaround for something. It would be best to stop 0x0 frames from being created in the first place, but a reasonable quick fix is to just not draw those frames. Bug: webrtc:10367 Change-Id: Ib93057c4de7285773c99614b4e7d9bd4b099c4dc Reviewed-on: https://webrtc-review.googlesource.com/c/124988 Commit-Queue: Paulina Hensman Reviewed-by: Sami Kalliomäki Cr-Commit-Position: refs/heads/master@{#26897} --- sdk/android/api/org/webrtc/VideoFrameDrawer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/android/api/org/webrtc/VideoFrameDrawer.java b/sdk/android/api/org/webrtc/VideoFrameDrawer.java index 076aabd6ed..7563ebabc9 100644 --- a/sdk/android/api/org/webrtc/VideoFrameDrawer.java +++ b/sdk/android/api/org/webrtc/VideoFrameDrawer.java @@ -22,6 +22,7 @@ import java.nio.ByteBuffer; * taken into account. You can supply an additional render matrix for custom transformations. */ public class VideoFrameDrawer { + public static final String TAG = "VideoFrameDrawer"; /** * Draws a VideoFrame.TextureBuffer. Calls either drawer.drawOes or drawer.drawRgb * depending on the type of the buffer. You can supply an additional render matrix. This is @@ -189,6 +190,10 @@ public class VideoFrameDrawer { int viewportHeight) { final int width = frame.getRotatedWidth(); final int height = frame.getRotatedHeight(); + if (width <= 0 || height <= 0) { + Logging.w(TAG, "Illegal frame size: " + height + "x" + width); + return; + } calculateTransformedRenderSize(width, height, additionalRenderMatrix);