Index: webrtc/media/base/videocommon_unittest.cc |
diff --git a/webrtc/media/base/videocommon_unittest.cc b/webrtc/media/base/videocommon_unittest.cc |
index 84a728b19b14da8b5e45efd3657da7faaac6cf29..c28a5d25bae711b8d579c392910cd5d97dad9cd0 100644 |
--- a/webrtc/media/base/videocommon_unittest.cc |
+++ b/webrtc/media/base/videocommon_unittest.cc |
@@ -91,221 +91,4 @@ TEST(VideoCommonTest, TestVideoFormatCompare) { |
EXPECT_TRUE(format.IsPixelRateLess(format2)); |
} |
-TEST(VideoCommonTest, TestComputeScaleWithLowFps) { |
- int scaled_width, scaled_height; |
- |
- // Request small enough. Expect no change. |
- ComputeScale(2560, 1600, 5, &scaled_width, &scaled_height); |
- EXPECT_EQ(2560, scaled_width); |
- EXPECT_EQ(1600, scaled_height); |
- |
- // Request too many pixels. Expect 1/2 size. |
- ComputeScale(4096, 2560, 5, &scaled_width, &scaled_height); |
- EXPECT_EQ(2048, scaled_width); |
- EXPECT_EQ(1280, scaled_height); |
- |
- // Request too many pixels and too wide and tall. Expect 1/4 size. |
- ComputeScale(16000, 10000, 5, &scaled_width, &scaled_height); |
- EXPECT_EQ(2000, scaled_width); |
- EXPECT_EQ(1250, scaled_height); |
- |
- // Request too wide. (two 30 inch monitors). Expect 1/2 size. |
- ComputeScale(5120, 1600, 5, &scaled_width, &scaled_height); |
- EXPECT_EQ(2560, scaled_width); |
- EXPECT_EQ(800, scaled_height); |
- |
- // Request too wide but not too many pixels. Expect 1/2 size. |
- ComputeScale(8192, 1024, 5, &scaled_width, &scaled_height); |
- EXPECT_EQ(4096, scaled_width); |
- EXPECT_EQ(512, scaled_height); |
- |
- // Request too tall. Expect 1/4 size. |
- ComputeScale(1024, 8192, 5, &scaled_width, &scaled_height); |
- EXPECT_EQ(256, scaled_width); |
- EXPECT_EQ(2048, scaled_height); |
-} |
- |
-// Same as TestComputeScale but with 15 fps instead of 5 fps. |
-// Disabled for UBSan: https://bugs.chromium.org/p/webrtc/issues/detail?id=5487 |
-#ifdef UNDEFINED_SANITIZER |
-#define MAYBE_TestComputeScaleWithHighFps DISABLED_TestComputeScaleWithHighFps |
-#else |
-#define MAYBE_TestComputeScaleWithHighFps TestComputeScaleWithHighFps |
-#endif |
-TEST(VideoCommonTest, MAYBE_TestComputeScaleWithHighFps) { |
- int scaled_width, scaled_height; |
- |
- // Request small enough but high fps. Expect 1/2 size. |
- ComputeScale(2560, 1600, 15, &scaled_width, &scaled_height); |
- EXPECT_EQ(1280, scaled_width); |
- EXPECT_EQ(800, scaled_height); |
- |
- // Request too many pixels. Expect 1/2 size. |
- ComputeScale(4096, 2560, 15, &scaled_width, &scaled_height); |
- EXPECT_EQ(2048, scaled_width); |
- EXPECT_EQ(1280, scaled_height); |
- |
- // Request too many pixels and too wide and tall. Expect 1/16 size. |
- ComputeScale(64000, 40000, 15, &scaled_width, &scaled_height); |
- EXPECT_EQ(4000, scaled_width); |
- EXPECT_EQ(2500, scaled_height); |
- |
- // Request too wide. (two 30 inch monitors). Expect 1/2 size. |
- ComputeScale(5120, 1600, 15, &scaled_width, &scaled_height); |
- EXPECT_EQ(2560, scaled_width); |
- EXPECT_EQ(800, scaled_height); |
- |
- // Request too wide but not too many pixels. Expect 1/2 size. |
- ComputeScale(8192, 1024, 15, &scaled_width, &scaled_height); |
- EXPECT_EQ(4096, scaled_width); |
- EXPECT_EQ(512, scaled_height); |
- |
- // Request too tall. Expect 1/4 size. |
- ComputeScale(1024, 8192, 15, &scaled_width, &scaled_height); |
- EXPECT_EQ(256, scaled_width); |
- EXPECT_EQ(2048, scaled_height); |
-} |
- |
-TEST(VideoCommonTest, TestComputeCrop) { |
- int cropped_width, cropped_height; |
- |
- // Request 16:9 to 16:9. Expect no cropping. |
- ComputeCrop(1280, 720, // Crop size 16:9 |
- 640, 360, // Frame is 4:3 |
- 1, 1, // Normal 1:1 pixels |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(640, cropped_width); |
- EXPECT_EQ(360, cropped_height); |
- |
- // Request 4:3 to 16:9. Expect vertical. |
- ComputeCrop(640, 360, // Crop size 16:9 |
- 640, 480, // Frame is 4:3 |
- 1, 1, // Normal 1:1 pixels |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(640, cropped_width); |
- EXPECT_EQ(360, cropped_height); |
- |
- // Request 16:9 to 4:3. Expect horizontal crop. |
- ComputeCrop(640, 480, // Crop size 4:3 |
- 640, 360, // Frame is 16:9 |
- 1, 1, // Normal 1:1 pixels |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(480, cropped_width); |
- EXPECT_EQ(360, cropped_height); |
- |
- // Request 16:9 but VGA has 3:8 pixel aspect ratio. Expect no crop. |
- // This occurs on HP4110 on OSX 10.5/10.6/10.7 |
- ComputeCrop(640, 360, // Crop size 16:9 |
- 640, 480, // Frame is 4:3 |
- 3, 8, // Pixel aspect ratio is tall |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(640, cropped_width); |
- EXPECT_EQ(480, cropped_height); |
- |
- // Request 16:9 but QVGA has 15:11 pixel aspect ratio. Expect horizontal crop. |
- // This occurs on Logitech B910 on OSX 10.5/10.6/10.7 in Hangouts. |
- ComputeCrop(640, 360, // Crop size 16:9 |
- 320, 240, // Frame is 4:3 |
- 15, 11, // Pixel aspect ratio is wide |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(312, cropped_width); |
- EXPECT_EQ(240, cropped_height); |
- |
- // Request 16:10 but QVGA has 15:11 pixel aspect ratio. |
- // Expect horizontal crop. |
- // This occurs on Logitech B910 on OSX 10.5/10.6/10.7 in gmail. |
- ComputeCrop(640, 400, // Crop size 16:10 |
- 320, 240, // Frame is 4:3 |
- 15, 11, // Pixel aspect ratio is wide |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(280, cropped_width); |
- EXPECT_EQ(240, cropped_height); |
- |
- // Request 16:9 but VGA has 6:5 pixel aspect ratio. Expect vertical crop. |
- // This occurs on Logitech QuickCam Pro C9000 on OSX |
- ComputeCrop(640, 360, // Crop size 16:9 |
- 640, 480, // Frame is 4:3 |
- 6, 5, // Pixel aspect ratio is wide |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(640, cropped_width); |
- EXPECT_EQ(432, cropped_height); |
- |
- // Request 16:10 but HD is 16:9. Expect horizontal crop. |
- // This occurs in settings and local preview with HD experiment. |
- ComputeCrop(1280, 800, // Crop size 16:10 |
- 1280, 720, // Frame is 4:3 |
- 1, 1, // Pixel aspect ratio is wide |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(1152, cropped_width); |
- EXPECT_EQ(720, cropped_height); |
- |
- // Request 16:9 but HD has 3:4 pixel aspect ratio. Expect vertical crop. |
- // This occurs on Logitech B910 on OSX 10.5/10.6.7 but not OSX 10.6.8 or 10.7 |
- ComputeCrop(1280, 720, // Crop size 16:9 |
- 1280, 720, // Frame is 4:3 |
- 3, 4, // Pixel aspect ratio is wide |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(1280, cropped_width); |
- EXPECT_EQ(540, cropped_height); |
- |
- // Request 16:9 to 3:4 (portrait). Expect no cropping. |
- ComputeCrop(640, 360, // Crop size 16:9 |
- 640, 480, // Frame is 3:4 portrait |
- 1, 1, // Normal 1:1 pixels |
- 90, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(640, cropped_width); |
- EXPECT_EQ(480, cropped_height); |
- |
- // Request 9:16 from VGA rotated (portrait). Expect crop. |
- ComputeCrop(360, 640, // Crop size 9:16 |
- 640, 480, // Frame is 3:4 portrait |
- 1, 1, // Normal 1:1 pixels |
- 90, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(640, cropped_width); |
- EXPECT_EQ(360, cropped_height); |
- |
- // Cropped size 0x0. Expect no cropping. |
- // This is used when adding multiple capturers |
- ComputeCrop(0, 0, // Crop size 0x0 |
- 1024, 768, // Frame is 3:4 portrait |
- 1, 1, // Normal 1:1 pixels |
- 0, |
- &cropped_width, &cropped_height); |
- EXPECT_EQ(1024, cropped_width); |
- EXPECT_EQ(768, cropped_height); |
-} |
- |
-TEST(VideoCommonTest, TestComputeScaleToSquarePixels) { |
- int scaled_width, scaled_height; |
- |
- // Pixel aspect ratio is 4:3. Logical aspect ratio is 16:9. Expect scale |
- // to square pixels with physical aspect ratio of 16:9. |
- ComputeScaleToSquarePixels(640, 480, |
- 4, 3, // 4 x 3 pixel aspect ratio |
- &scaled_width, &scaled_height); |
- EXPECT_EQ(640, scaled_width); |
- EXPECT_EQ(360, scaled_height); |
- |
- // Pixel aspect ratio is 3:8. Physical aspect ratio is 4:3. Expect scale |
- // to square pixels with logical aspect ratio of 1:2. |
- // Note that 640x1280 will be scaled down by video adapter to view request |
- // of 640*360 and will end up using 320x640. |
- ComputeScaleToSquarePixels(640, 480, |
- 3, 8, // 4 x 3 pixel aspect ratio |
- &scaled_width, &scaled_height); |
- EXPECT_EQ(640, scaled_width); |
- EXPECT_EQ(1280, scaled_height); |
-} |
- |
} // namespace cricket |