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
diff --git a/talk/media/base/videoframefactory.cc b/talk/media/base/videoframefactory.cc
index 147f1fa..4e59611 100644
--- a/talk/media/base/videoframefactory.cc
+++ b/talk/media/base/videoframefactory.cc
@@ -27,6 +27,7 @@
#include "talk/media/base/videoframefactory.h"
+#include <algorithm>
#include "talk/media/base/videocapturer.h"
namespace cricket {
@@ -46,6 +47,13 @@
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() ||