| Index: webrtc/media/engine/webrtcvideoengine2_unittest.cc
|
| diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
|
| index 5c560c159c54c9ecac926f2f18156551b736fabd..9edadff1751af39bbeabb3f66b064b0967bd7fb9 100644
|
| --- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc
|
| +++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
|
| @@ -14,7 +14,6 @@
|
| #include <vector>
|
|
|
| #include "webrtc/base/arraysize.h"
|
| -#include "webrtc/base/gunit.h"
|
| #include "webrtc/base/stringutils.h"
|
| #include "webrtc/call/flexfec_receive_stream.h"
|
| #include "webrtc/common_video/h264/profile_level_id.h"
|
| @@ -30,6 +29,7 @@
|
| #include "webrtc/media/engine/webrtcvideoengine2.h"
|
| #include "webrtc/media/engine/webrtcvoiceengine.h"
|
| #include "webrtc/test/field_trial.h"
|
| +#include "webrtc/test/gtest.h"
|
| #include "webrtc/video_encoder.h"
|
|
|
| using webrtc::RtpExtension;
|
| @@ -2103,8 +2103,9 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
|
|
|
| // Trigger overuse.
|
| rtc::VideoSinkWants wants;
|
| - wants.max_pixel_count = rtc::Optional<int>(
|
| - send_stream->GetLastWidth() * send_stream->GetLastHeight() - 1);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (send_stream->GetLastWidth() * send_stream->GetLastHeight() * 3) / 5,
|
| + send_stream->GetLastWidth() * send_stream->GetLastHeight() - 1));
|
| send_stream->InjectVideoSinkWants(wants);
|
| EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420));
|
| EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames());
|
| @@ -2112,8 +2113,9 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
|
| EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight());
|
|
|
| // Trigger overuse again.
|
| - wants.max_pixel_count = rtc::Optional<int>(
|
| - send_stream->GetLastWidth() * send_stream->GetLastHeight() - 1);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (send_stream->GetLastWidth() * send_stream->GetLastHeight() * 3) / 5,
|
| + send_stream->GetLastWidth() * send_stream->GetLastHeight() - 1));
|
| send_stream->InjectVideoSinkWants(wants);
|
| EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420));
|
| EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames());
|
| @@ -2131,9 +2133,9 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
|
| send_stream->GetLastWidth() * send_stream->GetLastHeight();
|
| // Cap the max to 4x the pixel count (assuming max 1/2 x 1/2 scale downs)
|
| // of the current stream, so we don't take too large steps.
|
| - wants.max_pixel_count = rtc::Optional<int>(current_pixel_count * 4);
|
| // Default step down is 3/5 pixel count, so go up by 5/3.
|
| - wants.target_pixel_count = rtc::Optional<int>((current_pixel_count * 5) / 3);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (current_pixel_count * 5) / 3, current_pixel_count * 4));
|
| send_stream->InjectVideoSinkWants(wants);
|
| EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420));
|
| EXPECT_EQ(5, send_stream->GetNumberOfSwappedFrames());
|
| @@ -2143,8 +2145,8 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
|
| // Trigger underuse again, should go back up to full resolution.
|
| current_pixel_count =
|
| send_stream->GetLastWidth() * send_stream->GetLastHeight();
|
| - wants.max_pixel_count = rtc::Optional<int>(current_pixel_count * 4);
|
| - wants.target_pixel_count = rtc::Optional<int>((current_pixel_count * 5) / 3);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (current_pixel_count * 5) / 3, current_pixel_count * 4));
|
| send_stream->InjectVideoSinkWants(wants);
|
| EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420));
|
| EXPECT_EQ(6, send_stream->GetNumberOfSwappedFrames());
|
| @@ -2187,8 +2189,9 @@ TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) {
|
|
|
| // Trigger overuse.
|
| rtc::VideoSinkWants wants;
|
| - wants.max_pixel_count = rtc::Optional<int>(
|
| - send_stream->GetLastWidth() * send_stream->GetLastHeight() - 1);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (send_stream->GetLastWidth() * send_stream->GetLastHeight() * 3) / 5,
|
| + send_stream->GetLastWidth() * send_stream->GetLastHeight() - 1));
|
| send_stream->InjectVideoSinkWants(wants);
|
| EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420));
|
| EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames());
|
| @@ -2266,8 +2269,9 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
|
| ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
|
|
|
| rtc::VideoSinkWants wants;
|
| - wants.max_pixel_count =
|
| - rtc::Optional<int>(capture_format.width * capture_format.height - 1);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (capture_format.width * capture_format.height * 3) / 5,
|
| + capture_format.width * capture_format.height - 1));
|
| send_stream->InjectVideoSinkWants(wants);
|
|
|
| EXPECT_TRUE(capturer.CaptureFrame());
|
| @@ -2282,8 +2286,8 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
|
| // Trigger underuse which should go back to normal resolution.
|
| int last_pixel_count =
|
| send_stream->GetLastWidth() * send_stream->GetLastHeight();
|
| - wants.max_pixel_count = rtc::Optional<int>(last_pixel_count * 4);
|
| - wants.target_pixel_count = rtc::Optional<int>((last_pixel_count * 5) / 3);
|
| + wants.pixel_count.emplace(rtc::VideoSinkWants::Range(
|
| + 0, (last_pixel_count * 5) / 3, last_pixel_count * 4));
|
| send_stream->InjectVideoSinkWants(wants);
|
|
|
| EXPECT_TRUE(capturer.CaptureFrame());
|
|
|