diff --git a/webrtc/media/base/videobroadcaster_unittest.cc b/webrtc/media/base/videobroadcaster_unittest.cc index 644fa75761..c6a4df0e66 100644 --- a/webrtc/media/base/videobroadcaster_unittest.cc +++ b/webrtc/media/base/videobroadcaster_unittest.cc @@ -58,7 +58,7 @@ TEST(VideoBroadcasterTest, OnFrame) { TEST(VideoBroadcasterTest, AppliesRotationIfAnySinkWantsRotationApplied) { VideoBroadcaster broadcaster; - EXPECT_TRUE(broadcaster.wants().rotation_applied); + EXPECT_FALSE(broadcaster.wants().rotation_applied); FakeVideoRenderer sink1; VideoSinkWants wants1; diff --git a/webrtc/media/base/videocapturer.cc b/webrtc/media/base/videocapturer.cc index 4923dddd96..a98f2f547f 100644 --- a/webrtc/media/base/videocapturer.cc +++ b/webrtc/media/base/videocapturer.cc @@ -60,7 +60,7 @@ bool CapturedFrame::GetDataSize(uint32_t* size) const { ///////////////////////////////////////////////////////////////////// // Implementation of class VideoCapturer ///////////////////////////////////////////////////////////////////// -VideoCapturer::VideoCapturer() : apply_rotation_(true) { +VideoCapturer::VideoCapturer() : apply_rotation_(false) { thread_checker_.DetachFromThread(); Construct(); } diff --git a/webrtc/media/base/videocapturer_unittest.cc b/webrtc/media/base/videocapturer_unittest.cc index 0d5a59e9b7..40c770608f 100644 --- a/webrtc/media/base/videocapturer_unittest.cc +++ b/webrtc/media/base/videocapturer_unittest.cc @@ -116,6 +116,10 @@ TEST_F(VideoCapturerTest, TestRotationAppliedBySource) { cricket::FOURCC_I420)); capturer_->ResetSupportedFormats(formats); + rtc::VideoSinkWants wants; + // |capturer_| should compensate rotation. + wants.rotation_applied = true; + capturer_->AddOrUpdateSink(&renderer_, wants); // capturer_ should compensate rotation as default. EXPECT_EQ(cricket::CS_RUNNING, @@ -154,7 +158,7 @@ TEST_F(VideoCapturerTest, TestRotationAppliedBySource) { EXPECT_EQ(webrtc::kVideoRotation_0, renderer_.rotation()); } -TEST_F(VideoCapturerTest, TestRotationAppliedBySink) { +TEST_F(VideoCapturerTest, TestRotationAppliedBySinkByDefault) { int kWidth = 800; int kHeight = 400; @@ -164,10 +168,6 @@ TEST_F(VideoCapturerTest, TestRotationAppliedBySink) { cricket::FOURCC_I420)); capturer_->ResetSupportedFormats(formats); - rtc::VideoSinkWants wants; - // capturer_ should not compensate rotation. - wants.rotation_applied = false; - capturer_->AddOrUpdateSink(&renderer_, wants); EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(cricket::VideoFormat( diff --git a/webrtc/media/base/videoframefactory.h b/webrtc/media/base/videoframefactory.h index 41e9e09499..6aa2ce5173 100644 --- a/webrtc/media/base/videoframefactory.h +++ b/webrtc/media/base/videoframefactory.h @@ -24,7 +24,7 @@ class VideoFrame; // depending on the subclass of VideoFrameFactory. class VideoFrameFactory { public: - VideoFrameFactory() : apply_rotation_(true) {} + VideoFrameFactory() : apply_rotation_(false) {} virtual ~VideoFrameFactory() {} // The returned frame aliases the aliased_frame if the input color diff --git a/webrtc/media/base/videosourceinterface.h b/webrtc/media/base/videosourceinterface.h index e96a901f7d..bae02c8d0f 100644 --- a/webrtc/media/base/videosourceinterface.h +++ b/webrtc/media/base/videosourceinterface.h @@ -20,8 +20,8 @@ namespace rtc { // should have when it is delivered to a certain sink. struct VideoSinkWants { // Tells the source whether the sink wants frames with rotation applied. - // By default, the rotation is applied by the source. - bool rotation_applied = true; + // By default, any rotation must be applied by the sink. + bool rotation_applied = false; // Tells the source that the sink only wants black frames. bool black_frames = false; diff --git a/webrtc/modules/video_capture/test/video_capture_unittest.cc b/webrtc/modules/video_capture/test/video_capture_unittest.cc index 600b618f5c..04f0a5ce09 100644 --- a/webrtc/modules/video_capture/test/video_capture_unittest.cc +++ b/webrtc/modules/video_capture/test/video_capture_unittest.cc @@ -112,14 +112,9 @@ class TestVideoCaptureCallback : public VideoCaptureDataCallback { EXPECT_TRUE(height == capability_.height || height == capability_.width); EXPECT_TRUE(width == capability_.width || width == capability_.height); #else - if (rotate_frame_ == webrtc::kVideoRotation_90 || - rotate_frame_ == webrtc::kVideoRotation_270) { - EXPECT_EQ(width, capability_.height); - EXPECT_EQ(height, capability_.width); - } else { - EXPECT_EQ(height, capability_.height); - EXPECT_EQ(width, capability_.width); - } + EXPECT_EQ(height, capability_.height); + EXPECT_EQ(width, capability_.width); + EXPECT_EQ(rotate_frame_, videoFrame.rotation()); #endif // RenderTimstamp should be the time now. EXPECT_TRUE( diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc index 81f6311e65..8319a21562 100644 --- a/webrtc/modules/video_capture/video_capture_impl.cc +++ b/webrtc/modules/video_capture/video_capture_impl.cc @@ -155,7 +155,7 @@ VideoCaptureImpl::VideoCaptureImpl(const int32_t id) _captureCallBack(NULL), _lastProcessFrameCount(TickTime::Now()), _rotateFrame(kVideoRotation_0), - apply_rotation_(true) { + apply_rotation_(false) { _requestedCapability.width = kDefaultWidth; _requestedCapability.height = kDefaultHeight; _requestedCapability.maxFPS = 30;