Check render size instead of frame size.

Even if neither frame height nor frame width is <=0 we can end up
with <=0 dimensions in renderHeight or renderWidth. With this change,
we perform the check on the latter.

Bug: webrtc:10367
Change-Id: I9672672659ad7d12cf1e7ccab5b5cde583ae7e8c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129760
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27307}
This commit is contained in:
Paulina Hensman
2019-03-26 16:47:08 +01:00
committed by Commit Bot
parent 7d72d0fb39
commit 8f22a28e30

View File

@ -190,13 +190,12 @@ 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);
calculateTransformedRenderSize(width, height, additionalRenderMatrix);
if (renderWidth <= 0 || renderHeight <= 0) {
Logging.w(TAG, "Illegal frame size: " + renderWidth + "x" + renderHeight);
return;
}
calculateTransformedRenderSize(width, height, additionalRenderMatrix);
final boolean isTextureFrame = frame.getBuffer() instanceof VideoFrame.TextureBuffer;
renderMatrix.reset();
renderMatrix.preTranslate(0.5f, 0.5f);