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() ||