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}
This commit is contained in:
Paulina Hensman
2019-02-28 14:27:28 +01:00
committed by Commit Bot
parent 40b030edbf
commit cf7c58458e

View File

@ -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);