From be00e3c198f00bdbc81ea4a00ea0893b2097f543 Mon Sep 17 00:00:00 2001 From: "perkj@webrtc.org" Date: Tue, 3 Mar 2015 10:48:15 +0000 Subject: [PATCH] Make sure VideoFrameFactory handles rotated frames when scaling. BUG=4366 R=magjed@webrtc.org Review URL: https://webrtc-codereview.appspot.com/41079004 Cr-Commit-Position: refs/heads/master@{#8570} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8570 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/media/base/videoframefactory.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/talk/media/base/videoframefactory.cc b/talk/media/base/videoframefactory.cc index 147f1faf81..4e596119be 100644 --- a/talk/media/base/videoframefactory.cc +++ b/talk/media/base/videoframefactory.cc @@ -27,6 +27,7 @@ #include "talk/media/base/videoframefactory.h" +#include #include "talk/media/base/videocapturer.h" namespace cricket { @@ -46,6 +47,13 @@ VideoFrame* VideoFrameFactory::CreateAliasedFrame( return cropped_input_frame.release(); } + // If the frame is rotated, we need to switch the width and height. + if (apply_rotation_ && + (input_frame->GetRotation() == webrtc::kVideoRotation_90 || + input_frame->GetRotation() == webrtc::kVideoRotation_270)) { + std::swap(output_width, output_height); + } + // Create and stretch the output frame if it has not been created yet, is // still in use by others, or its size is not same as the expected. if (!output_frame_ || !output_frame_->IsExclusive() ||