| 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..66ad1c6687d7cc1ef0989497a51e185693bf6cfb 100644
|
| --- a/webrtc/media/base/videoadapter_unittest.cc
|
| +++ b/webrtc/media/base/videoadapter_unittest.cc
|
| @@ -28,8 +28,7 @@ class VideoAdapterTest : public testing::Test {
|
| virtual void SetUp() {
|
| capturer_.reset(new FakeVideoCapturer);
|
| capture_format_ = capturer_->GetSupportedFormats()->at(0);
|
| - capture_format_.interval = VideoFormat::FpsToInterval(50);
|
| - adapter_.SetExpectedInputFrameInterval(capture_format_.interval);
|
| + capture_format_.interval = VideoFormat::FpsToInterval(30);
|
|
|
| listener_.reset(new VideoCapturerListener(&adapter_));
|
| capturer_->SignalFrameCaptured.connect(
|
| @@ -73,6 +72,7 @@ class VideoAdapterTest : public testing::Test {
|
| int out_width;
|
| int out_height;
|
| video_adapter_->AdaptFrameResolution(in_width, in_height,
|
| + captured_frame->time_stamp,
|
| &cropped_width, &cropped_height,
|
| &out_width, &out_height);
|
| if (out_width != 0 && out_height != 0) {
|
| @@ -170,39 +170,121 @@ TEST_F(VideoAdapterTest, AdaptZeroInterval) {
|
|
|
| // Adapt the frame rate to be half of the capture rate at the beginning. Expect
|
| // the number of dropped frames to be half of the number the captured frames.
|
| -TEST_F(VideoAdapterTest, AdaptFramerate) {
|
| +TEST_F(VideoAdapterTest, AdaptFramerateToHalf) {
|
| VideoFormat request_format = capture_format_;
|
| request_format.interval *= 2;
|
| adapter_.OnOutputFormatRequest(request_format);
|
| EXPECT_EQ(CS_RUNNING, capturer_->Start(capture_format_));
|
| - for (int i = 0; i < 10; ++i)
|
| - capturer_->CaptureFrame();
|
|
|
| - // Verify frame drop and no resolution change.
|
| - VideoCapturerListener::Stats stats = listener_->GetStats();
|
| - EXPECT_GE(stats.captured_frames, 10);
|
| - EXPECT_EQ(stats.captured_frames / 2, stats.dropped_frames);
|
| - VerifyAdaptedResolution(stats, capture_format_.width, capture_format_.height,
|
| - capture_format_.width, capture_format_.height);
|
| + // Capture 5 frames and verify that every other frame is dropped. The first
|
| + // frame should not be dropped.
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 1);
|
| + EXPECT_EQ(0, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 2);
|
| + EXPECT_EQ(1, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 3);
|
| + EXPECT_EQ(1, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 4);
|
| + EXPECT_EQ(2, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 5);
|
| + EXPECT_EQ(2, listener_->GetStats().dropped_frames);
|
| }
|
|
|
| -// Adapt the frame rate to be half of the capture rate at the beginning. Expect
|
| -// the number of dropped frames to be half of the number the captured frames.
|
| -TEST_F(VideoAdapterTest, AdaptFramerateVariable) {
|
| +// Adapt the frame rate to be two thirds of the capture rate at the beginning.
|
| +// Expect the number of dropped frames to be one thirds of the number the
|
| +// captured frames.
|
| +TEST_F(VideoAdapterTest, AdaptFramerateToTwoThirds) {
|
| VideoFormat request_format = capture_format_;
|
| request_format.interval = request_format.interval * 3 / 2;
|
| adapter_.OnOutputFormatRequest(request_format);
|
| EXPECT_EQ(CS_RUNNING, capturer_->Start(capture_format_));
|
| - for (int i = 0; i < 30; ++i)
|
| +
|
| + // Capture 8 frames and verify that every third frame is dropped. The first
|
| + // frame should not be dropped.
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 1);
|
| + EXPECT_EQ(0, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 2);
|
| + EXPECT_EQ(1, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 3);
|
| + EXPECT_EQ(1, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 4);
|
| + EXPECT_EQ(1, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 5);
|
| + EXPECT_EQ(2, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 6);
|
| + EXPECT_EQ(2, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 7);
|
| + EXPECT_EQ(2, listener_->GetStats().dropped_frames);
|
| +
|
| + capturer_->CaptureFrame();
|
| + EXPECT_GE(listener_->GetStats().captured_frames, 8);
|
| + EXPECT_EQ(3, listener_->GetStats().dropped_frames);
|
| +}
|
| +
|
| +// Request frame rate twice as high as captured frame rate. Expect no frame
|
| +// drop.
|
| +TEST_F(VideoAdapterTest, AdaptFramerateHighLimit) {
|
| + VideoFormat request_format = capture_format_;
|
| + request_format.interval /= 2;
|
| + adapter_.OnOutputFormatRequest(request_format);
|
| + EXPECT_EQ(CS_RUNNING, capturer_->Start(capture_format_));
|
| + for (int i = 0; i < 10; ++i)
|
| capturer_->CaptureFrame();
|
|
|
| - // Verify frame drop and no resolution change.
|
| - VideoCapturerListener::Stats stats = listener_->GetStats();
|
| - EXPECT_GE(stats.captured_frames, 30);
|
| - // Verify 2 / 3 kept (20) and 1 / 3 dropped (10).
|
| - EXPECT_EQ(stats.captured_frames * 1 / 3, stats.dropped_frames);
|
| - VerifyAdaptedResolution(stats, capture_format_.width, capture_format_.height,
|
| - capture_format_.width, capture_format_.height);
|
| + // Verify no frame drop.
|
| + EXPECT_EQ(0, listener_->GetStats().dropped_frames);
|
| +}
|
| +
|
| +// Adapt three frames where the timestamp of the second frame is incorrectly
|
| +// less than the first timestamp. Expect that the adapter is conservative and
|
| +// does not drop any frame.
|
| +TEST_F(VideoAdapterTest, AdaptFramerateTimestampOutOfOrder) {
|
| + const int64_t capture_interval = VideoFormat::FpsToInterval(30);
|
| + adapter_.OnOutputFormatRequest(
|
| + VideoFormat(640, 480, capture_interval, cricket::FOURCC_ANY));
|
| +
|
| + const int64_t first_timestamp = capture_interval;
|
| + adapter_.AdaptFrameResolution(640, 480, first_timestamp,
|
| + &cropped_width_, &cropped_height_,
|
| + &out_width_, &out_height_);
|
| + EXPECT_GT(out_width_, 0);
|
| + EXPECT_GT(out_height_, 0);
|
| +
|
| + const int64_t second_timestamp = 0;
|
| + adapter_.AdaptFrameResolution(640, 480, second_timestamp,
|
| + &cropped_width_, &cropped_height_,
|
| + &out_width_, &out_height_);
|
| + EXPECT_GT(out_width_, 0);
|
| + EXPECT_GT(out_height_, 0);
|
| +
|
| + const int64_t third_timestamp = capture_interval;
|
| + adapter_.AdaptFrameResolution(640, 480, third_timestamp,
|
| + &cropped_width_, &cropped_height_,
|
| + &out_width_, &out_height_);
|
| + EXPECT_GT(out_width_, 0);
|
| + EXPECT_GT(out_height_, 0);
|
| }
|
|
|
| // Adapt the frame rate to be half of the capture rate after capturing no less
|
| @@ -237,7 +319,7 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionHighLimit) {
|
| output_format.height *= 10;
|
| adapter_.OnOutputFormatRequest(output_format);
|
| adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
|
| - &cropped_width_, &cropped_height_,
|
| + 0, &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(capture_format_.width, cropped_width_);
|
| EXPECT_EQ(capture_format_.height, cropped_height_);
|
| @@ -250,7 +332,7 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionHighLimit) {
|
| TEST_F(VideoAdapterTest, AdaptFrameResolutionIdentical) {
|
| adapter_.OnOutputFormatRequest(capture_format_);
|
| adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
|
| - &cropped_width_, &cropped_height_,
|
| + 0, &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(capture_format_.width, cropped_width_);
|
| EXPECT_EQ(capture_format_.height, cropped_height_);
|
| @@ -266,7 +348,7 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionQuarter) {
|
| request_format.height /= 2;
|
| adapter_.OnOutputFormatRequest(request_format);
|
| adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
|
| - &cropped_width_, &cropped_height_,
|
| + 0, &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(capture_format_.width, cropped_width_);
|
| EXPECT_EQ(capture_format_.height, cropped_height_);
|
| @@ -281,7 +363,7 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionDrop) {
|
| output_format.height = 0;
|
| adapter_.OnOutputFormatRequest(output_format);
|
| adapter_.AdaptFrameResolution(capture_format_.width, capture_format_.height,
|
| - &cropped_width_, &cropped_height_,
|
| + 0, &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(0, out_width_);
|
| EXPECT_EQ(0, out_height_);
|
| @@ -348,9 +430,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,
|
| + VideoFormat format(640, 400, 0, 0);
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -361,7 +442,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| // Format request 640x400.
|
| format.height = 400;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -374,7 +455,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 1280;
|
| format.height = 720;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -386,7 +467,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 0;
|
| format.height = 0;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(0, out_width_);
|
| @@ -396,7 +477,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 320;
|
| format.height = 200;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -410,7 +491,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 424;
|
| format.height = 265;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -422,7 +503,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 640 * 3 / 8;
|
| format.height = 400 * 3 / 8;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -434,7 +515,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 320;
|
| format.height = 200;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -446,7 +527,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
| format.width = 480;
|
| format.height = 300;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(640, 400,
|
| + adapter_.AdaptFrameResolution(640, 400, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -457,9 +538,8 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequest) {
|
|
|
| TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
|
| // Start at HD.
|
| - VideoFormat format(1280, 720, VideoFormat::FpsToInterval(30), 0);
|
| - adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + VideoFormat format(1280, 720, 0, 0);
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -471,7 +551,7 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
|
| format.width = 640;
|
| format.height = 360;
|
| adapter_.OnOutputFormatRequest(format);
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -481,7 +561,7 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
|
|
|
| // Now, the camera reopens at VGA.
|
| // Both the frame and the output format should be 640x360.
|
| - adapter_.AdaptFrameResolution(640, 360,
|
| + adapter_.AdaptFrameResolution(640, 360, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -492,7 +572,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 360, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -503,11 +583,10 @@ TEST_F(VideoAdapterTest, TestViewRequestPlusCameraSwitch) {
|
|
|
| TEST_F(VideoAdapterTest, TestVGAWidth) {
|
| // Reqeuested Output format is 640x360.
|
| - VideoFormat format(640, 360, VideoFormat::FpsToInterval(30), FOURCC_I420);
|
| - adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
|
| + VideoFormat format(640, 360, 0, FOURCC_I420);
|
| adapter_.OnOutputFormatRequest(format);
|
|
|
| - adapter_.AdaptFrameResolution(640, 480,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| // Expect cropping.
|
| @@ -517,7 +596,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 360, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -525,7 +604,7 @@ TEST_F(VideoAdapterTest, TestVGAWidth) {
|
| EXPECT_EQ(640, out_width_);
|
| EXPECT_EQ(360, out_height_);
|
|
|
| - adapter_.AdaptFrameResolution(640, 480,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -535,7 +614,7 @@ TEST_F(VideoAdapterTest, TestVGAWidth) {
|
| }
|
|
|
| TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -546,7 +625,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| // Adapt down one step.
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(1280 * 720 - 1),
|
| rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -557,7 +636,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| // Adapt down one step more.
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(960 * 540 - 1),
|
| rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -568,7 +647,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| // Adapt down one step more.
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
|
| rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -579,7 +658,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| // Adapt up one step.
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(),
|
| rtc::Optional<int>(480 * 270));
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -590,7 +669,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| // Adapt up one step more.
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(),
|
| rtc::Optional<int>(640 * 360));
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -601,7 +680,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| // Adapt up one step more.
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(),
|
| rtc::Optional<int>(960 * 720));
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -611,7 +690,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
| }
|
|
|
| TEST_F(VideoAdapterTest, TestOnResolutionRequestMaxZero) {
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -620,7 +699,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestMaxZero) {
|
| EXPECT_EQ(720, out_height_);
|
|
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(0), rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(0, out_width_);
|
| @@ -630,7 +709,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestMaxZero) {
|
| TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
|
| rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -640,7 +719,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
|
|
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(),
|
| rtc::Optional<int>(960 * 720));
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -652,7 +731,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
|
| TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
|
| rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -660,10 +739,9 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
|
| EXPECT_EQ(480, out_width_);
|
| EXPECT_EQ(270, out_height_);
|
|
|
| - VideoFormat new_format(640, 360, VideoFormat::FpsToInterval(30), FOURCC_I420);
|
| - adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
|
| + VideoFormat new_format(640, 360, 0, FOURCC_I420);
|
| adapter_.OnOutputFormatRequest(new_format);
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -673,7 +751,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
|
|
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(),
|
| rtc::Optional<int>(960 * 720));
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -683,7 +761,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
|
| }
|
|
|
| TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -693,7 +771,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
|
|
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 - 1),
|
| rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -702,7 +780,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
|
| EXPECT_EQ(270, out_height_);
|
|
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(), rtc::Optional<int>());
|
| - adapter_.AdaptFrameResolution(1280, 720,
|
| + adapter_.AdaptFrameResolution(1280, 720, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(1280, cropped_width_);
|
| @@ -713,11 +791,9 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
|
|
|
| TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
|
| // Ask for 640x360 (16:9 aspect).
|
| - adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
|
| - adapter_.OnOutputFormatRequest(
|
| - VideoFormat(640, 360, VideoFormat::FpsToInterval(30), FOURCC_I420));
|
| + adapter_.OnOutputFormatRequest(VideoFormat(640, 360, 0, FOURCC_I420));
|
| // Send 640x480 (4:3 aspect).
|
| - adapter_.AdaptFrameResolution(640, 480,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| // Expect cropping to 16:9 format and no scaling.
|
| @@ -730,7 +806,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -742,7 +818,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -754,7 +830,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -766,7 +842,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -778,7 +854,7 @@ 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,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
| EXPECT_EQ(640, cropped_width_);
|
| @@ -789,14 +865,13 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
|
|
|
| TEST_F(VideoAdapterTest, TestCroppingOddResolution) {
|
| // Ask for 640x360 (16:9 aspect), with 3/16 scaling.
|
| - adapter_.SetExpectedInputFrameInterval(VideoFormat::FpsToInterval(30));
|
| adapter_.OnOutputFormatRequest(
|
| - VideoFormat(640, 360, VideoFormat::FpsToInterval(30), FOURCC_I420));
|
| + VideoFormat(640, 360, 0, FOURCC_I420));
|
| adapter_.OnResolutionRequest(rtc::Optional<int>(640 * 360 * 3 / 16 * 3 / 16),
|
| rtc::Optional<int>());
|
|
|
| // Send 640x480 (4:3 aspect).
|
| - adapter_.AdaptFrameResolution(640, 480,
|
| + adapter_.AdaptFrameResolution(640, 480, 0,
|
| &cropped_width_, &cropped_height_,
|
| &out_width_, &out_height_);
|
|
|
|
|