Chromium Code Reviews| Index: webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
| diff --git a/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm b/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
| index 28ae3f2bd4102ac119778141a1cca2a0ed660052..cecb13cdb952052c0e9d9f0cdc88de6195f2c180 100644 |
| --- a/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
| +++ b/webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm |
| @@ -131,8 +131,8 @@ void AVFoundationVideoCapturer::CaptureSampleBuffer( |
| return; |
| } |
| - const int captured_width = CVPixelBufferGetWidth(image_buffer); |
| - const int captured_height = CVPixelBufferGetHeight(image_buffer); |
| + int captured_width = CVPixelBufferGetWidth(image_buffer); |
| + int captured_height = CVPixelBufferGetHeight(image_buffer); |
| int adapted_width; |
| int adapted_height; |
| @@ -161,10 +161,14 @@ void AVFoundationVideoCapturer::CaptureSampleBuffer( |
| // not critical here. |
| if (apply_rotation() && rotation != kVideoRotation_0) { |
| buffer = buffer->NativeToI420Buffer(); |
| - rtc::scoped_refptr<I420Buffer> rotated_buffer = |
| - (rotation == kVideoRotation_180) |
| - ? I420Buffer::Create(adapted_width, adapted_height) |
| - : I420Buffer::Create(adapted_height, adapted_width); |
| + rtc::scoped_refptr<I420Buffer> rotated_buffer; |
| + if (rotation == kVideoRotation_0 || rotation == kVideoRotation_180) { |
|
kthelgason
2017/01/09 08:18:28
The first case can never happen due to the outer c
magjed_webrtc
2017/01/09 09:31:14
Right, and the previous code just did (rotation ==
|
| + rotated_buffer = I420Buffer::Create(adapted_width, adapted_height); |
| + } else { |
| + // Swap width and height. |
| + rotated_buffer = I420Buffer::Create(adapted_height, adapted_width); |
| + std::swap(captured_width, captured_height); |
| + } |
| libyuv::I420Rotate( |
| buffer->DataY(), buffer->StrideY(), |
| buffer->DataU(), buffer->StrideU(), |
| @@ -175,6 +179,7 @@ void AVFoundationVideoCapturer::CaptureSampleBuffer( |
| buffer->width(), buffer->height(), |
| static_cast<libyuv::RotationMode>(rotation)); |
| buffer = rotated_buffer; |
| + rotation = kVideoRotation_0; |
| } |
| OnFrame(webrtc::VideoFrame(buffer, rotation, translated_camera_time_us), |