Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: webrtc/media/base/videocapturer_unittest.cc

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/base/videocapturer_unittest.cc
diff --git a/webrtc/media/base/videocapturer_unittest.cc b/webrtc/media/base/videocapturer_unittest.cc
index cbd92c5b8c32cf804b85274c652b88fb5b7b02ce..ebb51a6e3714e78376c0fd24ab068f4aa2a01e46 100644
--- a/webrtc/media/base/videocapturer_unittest.cc
+++ b/webrtc/media/base/videocapturer_unittest.cc
@@ -39,9 +39,10 @@ class VideoCapturerTest
num_state_changes_(0),
video_frames_received_(0),
expects_rotation_applied_(true) {
- capturer_.SignalVideoFrame.connect(this, &VideoCapturerTest::OnVideoFrame);
+ renderer_.SignalRenderFrame.connect(this, &VideoCapturerTest::OnVideoFrame);
capturer_.SignalStateChange.connect(this,
&VideoCapturerTest::OnStateChange);
+ capturer_.AddSink(&renderer_);
}
void set_expected_compensation(bool compensation) {
@@ -49,14 +50,13 @@ class VideoCapturerTest
}
protected:
- void OnVideoFrame(cricket::VideoCapturer*, const cricket::VideoFrame* frame) {
+ void OnVideoFrame(const cricket::VideoFrame* frame) {
++video_frames_received_;
if (expects_rotation_applied_) {
EXPECT_EQ(webrtc::kVideoRotation_0, frame->GetRotation());
} else {
EXPECT_EQ(capturer_.GetRotation(), frame->GetRotation());
}
- renderer_.RenderFrame(frame);
}
void OnStateChange(cricket::VideoCapturer*,
cricket::CaptureState capture_state) {
@@ -214,6 +214,7 @@ TEST_F(VideoCapturerTest, TestRotationPending) {
cricket::FOURCC_I420));
capturer_.ResetSupportedFormats(formats);
+
// capturer_ should compensate rotation as default.
capturer_.UpdateAspectRatio(400, 200);
@@ -261,9 +262,12 @@ TEST_F(VideoCapturerTest, TestRotationApplied) {
capturer_.ResetSupportedFormats(formats);
// capturer_ should not compensate rotation.
- capturer_.SetApplyRotation(false);
- capturer_.UpdateAspectRatio(400, 200);
set_expected_compensation(false);
+ rtc::VideoSinkHints hints;
+ hints.can_apply_rotation = true;
+ capturer_.AddOrUpdateSink(&renderer_, hints);
+
+ capturer_.UpdateAspectRatio(400, 200);
EXPECT_EQ(cricket::CS_RUNNING,
capturer_.Start(cricket::VideoFormat(

Powered by Google App Engine
This is Rietveld 408576698