| Index: webrtc/media/base/videoadapter_unittest.cc
|
| diff --git a/webrtc/media/base/videoadapter_unittest.cc b/webrtc/media/base/videoadapter_unittest.cc
|
| index 7f660ef37f2f3086ff438b782e04ff4e9dcceec5..d306298638e58546f08e3e56876eb7ccf5aaf70b 100644
|
| --- a/webrtc/media/base/videoadapter_unittest.cc
|
| +++ b/webrtc/media/base/videoadapter_unittest.cc
|
| @@ -951,4 +951,35 @@ TEST_F(VideoAdapterTest, TestCroppingOddResolution) {
|
| EXPECT_EQ(69, out_height_);
|
| }
|
|
|
| +TEST_F(VideoAdapterTest, TestAdaptToVerySmallResolution) {
|
| + // Ask for 1920x1080 (16:9 aspect), with 1/16 scaling.
|
| + const int w = 1920;
|
| + const int h = 1080;
|
| + adapter_.OnOutputFormatRequest(VideoFormat(w, h, 0, FOURCC_I420));
|
| + adapter_.OnResolutionRequest(rtc::Optional<int>(w * h * 1 / 16 * 1 / 16),
|
| + rtc::Optional<int>());
|
| +
|
| + // Send 1920x1080 (16:9 aspect).
|
| + EXPECT_TRUE(adapter_.AdaptFrameResolution(
|
| + w, h, 0, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
|
| +
|
| + // Instead of getting the exact aspect ratio with cropped resolution 1920x1080
|
| + // the resolution should be adjusted to get a perfect scale factor instead.
|
| + EXPECT_EQ(1920, cropped_width_);
|
| + EXPECT_EQ(1072, cropped_height_);
|
| + EXPECT_EQ(120, out_width_);
|
| + EXPECT_EQ(67, out_height_);
|
| +
|
| + // Adapt back up one step to 3/32.
|
| + adapter_.OnResolutionRequest(rtc::Optional<int>(),
|
| + rtc::Optional<int>(w * h * 1 / 16 * 1 / 16));
|
| +
|
| + // Send 1920x1080 (16:9 aspect).
|
| + EXPECT_TRUE(adapter_.AdaptFrameResolution(
|
| + w, h, 0, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
|
| +
|
| + EXPECT_EQ(180, out_width_);
|
| + EXPECT_EQ(99, out_height_);
|
| +}
|
| +
|
| } // namespace cricket
|
|
|