From 0eb7d3ff35c552d873c02add91844568a71f2d61 Mon Sep 17 00:00:00 2001 From: Robert Bares Date: Sun, 28 Oct 2018 00:16:33 +0000 Subject: [PATCH] Always call ConvertToI420 with positive crop_height Source height may be negative, causing libyuv to invert the image. However the height of the destination buffer specified by crop_height should be positive. Remaining calls in common_video_unittests are valid. Bug: webrtc:9447 Change-Id: I6d398909ae80a99d228ccbbd8c1d7ae804e5bf8d Reviewed-on: https://webrtc-review.googlesource.com/c/86540 Commit-Queue: Niels Moller Reviewed-by: Per Kjellander Reviewed-by: Niels Moller Cr-Commit-Position: refs/heads/master@{#25427} --- AUTHORS | 1 + modules/video_capture/video_capture_impl.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index c85a4e8764..1804f5fd31 100644 --- a/AUTHORS +++ b/AUTHORS @@ -48,6 +48,7 @@ Peng Yu Rafael Lopez Diez Ralph Giles Riku Voipio +Robert Bares Robert Nagy Ryan Yoakum Satender Saroha diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc index 53afed00b6..235fd3438a 100644 --- a/modules/video_capture/video_capture_impl.cc +++ b/modules/video_capture/video_capture_impl.cc @@ -143,7 +143,7 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame, int stride_y = width; int stride_uv = (width + 1) / 2; int target_width = width; - int target_height = height; + int target_height = abs(height); // SetApplyRotation doesn't take any lock. Make a local copy here. bool apply_rotation = apply_rotation_; @@ -163,7 +163,7 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame, // TODO(nisse): Use a pool? rtc::scoped_refptr buffer = I420Buffer::Create( - target_width, abs(target_height), stride_y, stride_uv, stride_uv); + target_width, target_height, stride_y, stride_uv, stride_uv); libyuv::RotationMode rotation_mode = libyuv::kRotate0; if (apply_rotation) {