Only draw frames with height and width >0
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 <phensman@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26897}
diff --git a/sdk/android/api/org/webrtc/VideoFrameDrawer.java b/sdk/android/api/org/webrtc/VideoFrameDrawer.java
index 076aabd..7563eba 100644
--- a/sdk/android/api/org/webrtc/VideoFrameDrawer.java
+++ b/sdk/android/api/org/webrtc/VideoFrameDrawer.java
@@ -22,6 +22,7 @@
* 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 @@
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);