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

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

Issue 1836043004: Cleanup the VideoAdapter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed nits. Created 4 years, 9 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 40c770608f9dfb547fc84e25389cd9db6d8f24db..bd145e33ea1c288437876e41c09bb0d3e882874a 100644
--- a/webrtc/media/base/videocapturer_unittest.cc
+++ b/webrtc/media/base/videocapturer_unittest.cc
@@ -256,9 +256,11 @@ TEST_F(VideoCapturerTest, SinkWantsMaxPixelAndMaxPixelCountStepUp) {
EXPECT_EQ(1280, renderer_.width());
EXPECT_EQ(720, renderer_.height());
- // Request a lower resolution.
+ // Request a lower resolution. The output resolution will have a resolution
+ // with less than or equal to |wants.max_pixel_count| depending on how the
+ // capturer can scale the input frame size.
rtc::VideoSinkWants wants;
- wants.max_pixel_count = rtc::Optional<int>(1280 * 720 / 2);
+ wants.max_pixel_count = rtc::Optional<int>(1280 * 720 * 3 / 5);
capturer_->AddOrUpdateSink(&renderer_, wants);
EXPECT_TRUE(capturer_->CaptureFrame());
EXPECT_EQ(2, renderer_.num_rendered_frames());
@@ -267,7 +269,7 @@ TEST_F(VideoCapturerTest, SinkWantsMaxPixelAndMaxPixelCountStepUp) {
// Request a lower resolution.
wants.max_pixel_count =
- rtc::Optional<int>(renderer_.width() * renderer_.height() / 2);
+ rtc::Optional<int>(renderer_.width() * renderer_.height() * 3 / 5);
capturer_->AddOrUpdateSink(&renderer_, wants);
EXPECT_TRUE(capturer_->CaptureFrame());
EXPECT_EQ(3, renderer_.num_rendered_frames());
@@ -306,6 +308,17 @@ TEST_F(VideoCapturerTest, SinkWantsMaxPixelAndMaxPixelCountStepUp) {
EXPECT_EQ(3, renderer2.num_rendered_frames());
EXPECT_EQ(960, renderer2.width());
EXPECT_EQ(540, renderer2.height());
+
+ // But resetting the wants should reset the resolution to what the camera is
pbos-webrtc 2016/04/05 10:16:55 was opened with
+ // opened with.
+ capturer_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants());
+ EXPECT_TRUE(capturer_->CaptureFrame());
+ EXPECT_EQ(7, renderer_.num_rendered_frames());
+ EXPECT_EQ(1280, renderer_.width());
+ EXPECT_EQ(720, renderer_.height());
+ EXPECT_EQ(4, renderer2.num_rendered_frames());
+ EXPECT_EQ(1280, renderer2.width());
+ EXPECT_EQ(720, renderer2.height());
}
TEST_F(VideoCapturerTest, ScreencastScaledSuperLarge) {

Powered by Google App Engine
This is Rietveld 408576698