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

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

Issue 1973873003: Delete AndroidVideoCapturer::FrameFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Move code to AndroidVideoCapturerJni. Make Matrix a class. Created 4 years, 7 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/videoadapter_unittest.cc
diff --git a/webrtc/media/base/videoadapter_unittest.cc b/webrtc/media/base/videoadapter_unittest.cc
index 92b4a558b9bedc9d1856303256bdc5860909dcc5..bda4d45efbf7cb8e2284816214d12faca61f5229 100644
--- a/webrtc/media/base/videoadapter_unittest.cc
+++ b/webrtc/media/base/videoadapter_unittest.cc
@@ -72,10 +72,9 @@ class VideoAdapterTest : public testing::Test {
int cropped_height;
int out_width;
int out_height;
- video_adapter_->AdaptFrameResolution(in_width, in_height,
- &cropped_width, &cropped_height,
- &out_width, &out_height);
- if (out_width != 0 && out_height != 0) {
+ if (video_adapter_->AdaptFrameResolution(in_width, in_height,
+ &cropped_width, &cropped_height,
+ &out_width, &out_height)) {
cropped_width_ = cropped_width;
cropped_height_ = cropped_height;
out_width_ = out_width;
@@ -236,9 +235,10 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionHighLimit) {
output_format.width *= 10;
output_format.height *= 10;
adapter_.OnOutputFormatRequest(output_format);
- adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ capture_format_.width, capture_format_.height,
+ &cropped_width_, &cropped_height_,
+ &out_width_, &out_height_));
EXPECT_EQ(capture_format_.width, cropped_width_);
EXPECT_EQ(capture_format_.height, cropped_height_);
EXPECT_EQ(capture_format_.width, out_width_);
@@ -249,9 +249,10 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionHighLimit) {
// cropping or resolution change.
TEST_F(VideoAdapterTest, AdaptFrameResolutionIdentical) {
adapter_.OnOutputFormatRequest(capture_format_);
- adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ capture_format_.width, capture_format_.height,
+ &cropped_width_, &cropped_height_,
+ &out_width_, &out_height_));
EXPECT_EQ(capture_format_.width, cropped_width_);
EXPECT_EQ(capture_format_.height, cropped_height_);
EXPECT_EQ(capture_format_.width, out_width_);
@@ -265,9 +266,10 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionQuarter) {
request_format.width /= 2;
request_format.height /= 2;
adapter_.OnOutputFormatRequest(request_format);
- adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ capture_format_.width, capture_format_.height,
+ &cropped_width_, &cropped_height_,
+ &out_width_, &out_height_));
EXPECT_EQ(capture_format_.width, cropped_width_);
EXPECT_EQ(capture_format_.height, cropped_height_);
EXPECT_EQ(request_format.width, out_width_);
@@ -280,11 +282,10 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionDrop) {
output_format.width = 0;
output_format.height = 0;
adapter_.OnOutputFormatRequest(output_format);
- adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
- EXPECT_EQ(0, out_width_);
- EXPECT_EQ(0, out_height_);
+ EXPECT_FALSE(adapter_.AdaptFrameResolution(
+ capture_format_.width, capture_format_.height,
+ &cropped_width_, &cropped_height_,
+ &out_width_, &out_height_));
}
// Adapt the frame resolution to be a quarter of the capture resolution at the
@@ -350,9 +351,8 @@ TEST_F(VideoAdapterTest, DropAllFrames) {
TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
VideoFormat format(640, 400, VideoFormat::FpsToInterval(30), 0);
adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -361,9 +361,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
// Format request 640x400.
format.height = 400;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -374,9 +373,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
format.width = 1280;
format.height = 720;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -386,19 +384,15 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
format.width = 0;
format.height = 0;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
- EXPECT_EQ(0, out_width_);
- EXPECT_EQ(0, out_height_);
+ EXPECT_FALSE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
// Request 320x200. Expect scaling, but no cropping.
format.width = 320;
format.height = 200;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(320, out_width_);
@@ -410,9 +404,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
format.width = 424;
format.height = 265;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(320, out_width_);
@@ -422,9 +415,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
format.width = 640 * 3 / 8;
format.height = 400 * 3 / 8;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(640 * 3 / 8, out_width_);
@@ -434,9 +426,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
format.width = 320;
format.height = 200;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(320, out_width_);
@@ -446,9 +437,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
format.width = 480;
format.height = 300;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 400,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 400, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(400, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -459,9 +449,8 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
// Start at HD.
VideoFormat format(1280, 720, VideoFormat::FpsToInterval(30), 0);
adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
@@ -471,9 +460,8 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
format.width = 640;
format.height = 360;
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -481,9 +469,8 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
// Now, the camera reopens at VGA.
// Both the frame and the output format should be 640x360.
- adapter_.AdaptFrameResolution(640, 360,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 360, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -492,9 +479,8 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
// And another view request comes in for 640x360, which should have no
// real impact.
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 360,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 360, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -507,9 +493,8 @@ TEST_F(VideoAdapterTest, TestVGAWidth) {
adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
adapter_.OnOutputFormatRequest(format);
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
// Expect cropping.
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
@@ -517,17 +502,15 @@ TEST_F(VideoAdapterTest, TestVGAWidth) {
EXPECT_EQ(360, out_height_);
// But if frames come in at 640x360, we shouldn't adapt them down.
- adapter_.AdaptFrameResolution(640, 360,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 360, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
EXPECT_EQ(360, out_height_);
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -535,9 +518,8 @@ TEST_F(VideoAdapterTest, TestVGAWidth) {
}
TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
@@ -546,9 +528,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
// Adapt down one step.
adapter_.OnResolutionRequest(rtc::Optional<int>(1280 * 720 - 1),
rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(960, out_width_);
@@ -557,9 +538,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
// Adapt down one step more.
adapter_.OnResolutionRequest(rtc::Optional<int>(960 * 540 - 1),
rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -568,9 +548,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
// Adapt down one step more.
adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -579,9 +558,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
// Adapt up one step.
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(480 * 270));
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -590,9 +568,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
// Adapt up one step more.
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(640 * 360));
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(960, out_width_);
@@ -601,9 +578,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
// Adapt up one step more.
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(960 * 720));
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
@@ -611,28 +587,23 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
}
TEST_F(VideoAdapterTest, TestOnResolutionRequestMaxZero) {
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
EXPECT_EQ(720, out_height_);
adapter_.OnResolutionRequest(rtc::Optional<int>(0), rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
- EXPECT_EQ(0, out_width_);
- EXPECT_EQ(0, out_height_);
+ EXPECT_FALSE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
}
TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -640,9 +611,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(960 * 720));
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
@@ -652,9 +622,8 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -663,9 +632,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
VideoFormat new_format(640, 360, VideoFormat::FpsToInterval(30), FOURCC_I420);
adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
adapter_.OnOutputFormatRequest(new_format);
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -673,9 +641,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(960 * 720));
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -683,9 +650,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
}
TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
@@ -693,18 +659,16 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(480, out_width_);
EXPECT_EQ(270, out_height_);
adapter_.OnResolutionRequest(rtc::Optional<int>(), rtc::Optional<int>());
- adapter_.AdaptFrameResolution(1280, 720,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 1280, 720, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(1280, cropped_width_);
EXPECT_EQ(720, cropped_height_);
EXPECT_EQ(1280, out_width_);
@@ -717,9 +681,8 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
adapter_.OnOutputFormatRequest(
VideoFormat(640, 360, VideoFormat::FpsToInterval(30), FOURCC_I420));
// Send 640x480 (4:3 aspect).
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
// Expect cropping to 16:9 format and no scaling.
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
@@ -730,9 +693,8 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
rtc::Optional<int>());
// Expect cropping to 16:9 format and 3/4 scaling.
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -742,9 +704,8 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
adapter_.OnResolutionRequest(rtc::Optional<int>(480 * 270 - 1),
rtc::Optional<int>());
// Expect cropping to 16:9 format and 1/2 scaling.
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(320, out_width_);
@@ -754,9 +715,8 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(320 * 180));
// Expect cropping to 16:9 format and 3/4 scaling.
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(480, out_width_);
@@ -766,9 +726,8 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(480 * 270));
// Expect cropping to 16:9 format and no scaling.
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -778,9 +737,8 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
adapter_.OnResolutionRequest(rtc::Optional<int>(),
rtc::Optional<int>(640 * 360));
// Expect cropping to 16:9 format and no scaling.
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
EXPECT_EQ(640, cropped_width_);
EXPECT_EQ(360, cropped_height_);
EXPECT_EQ(640, out_width_);
@@ -796,9 +754,8 @@ TEST_F(VideoAdapterTest, TestCroppingOddResolution) {
rtc::Optional<int>());
// Send 640x480 (4:3 aspect).
- adapter_.AdaptFrameResolution(640, 480,
- &cropped_width_, &cropped_height_,
- &out_width_, &out_height_);
+ EXPECT_TRUE(adapter_.AdaptFrameResolution(
+ 640, 480, &cropped_width_, &cropped_height_, &out_width_, &out_height_));
// Instead of getting the exact aspect ratio with cropped resolution 640x360,
// the resolution should be adjusted to get a perfect scale factor instead.

Powered by Google App Engine
This is Rietveld 408576698