Add quality upscaling tests.

Add tests verifying that min_start_bitrate limit in BitrateConstraint is met.

Bug: none
Change-Id: Icb9db5c92bf387d167ca0e27f5bd6fe0314504ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/218841
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34017}
This commit is contained in:
Åsa Persson 2021-05-17 10:37:28 +02:00 committed by WebRTC LUCI CQ
parent fef609afd0
commit 4e60937123

View File

@ -22,11 +22,12 @@
namespace webrtc {
namespace {
constexpr int kWidth = 1280;
constexpr int kHeight = 720;
constexpr int kInitialWidth = 1280;
constexpr int kInitialHeight = 720;
constexpr int kLowStartBps = 100000;
constexpr int kHighStartBps = 1000000;
constexpr size_t kTimeoutMs = 10000; // Some tests are expected to time out.
constexpr int kDefaultVgaMinStartBps = 500000; // From video_stream_encoder.cc
constexpr int kTimeoutMs = 10000; // Some tests are expected to time out.
void SetEncoderSpecific(VideoEncoderConfig* encoder_config,
VideoCodecType type,
@ -51,12 +52,6 @@ void SetEncoderSpecific(VideoEncoderConfig* encoder_config,
class QualityScalingTest : public test::CallTest {
protected:
void RunTest(const std::string& payload_name,
const std::vector<bool>& streams_active,
int start_bps,
bool automatic_resize,
bool expect_adaptation);
const std::string kPrefix = "WebRTC-Video-QualityScaling/Enabled-";
const std::string kEnd = ",0,0,0.9995,0.9999,1/";
const absl::optional<VideoEncoder::ResolutionBitrateLimits>
@ -71,153 +66,209 @@ class QualityScalingTest : public test::CallTest {
640 * 360);
};
void QualityScalingTest::RunTest(const std::string& payload_name,
const std::vector<bool>& streams_active,
int start_bps,
bool automatic_resize,
bool expect_adaptation) {
class ScalingObserver
: public test::SendTest,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
ScalingObserver(const std::string& payload_name,
class ScalingObserver : public test::SendTest {
protected:
ScalingObserver(const std::string& payload_name,
const std::vector<bool>& streams_active,
int start_bps,
bool automatic_resize,
bool expect_scaling)
: SendTest(expect_scaling ? kTimeoutMs * 4 : kTimeoutMs),
encoder_factory_(
[](const SdpVideoFormat& format) -> std::unique_ptr<VideoEncoder> {
if (format.name == "VP8")
return VP8Encoder::Create();
if (format.name == "VP9")
return VP9Encoder::Create();
if (format.name == "H264")
return H264Encoder::Create(cricket::VideoCodec("H264"));
RTC_NOTREACHED() << format.name;
return nullptr;
}),
payload_name_(payload_name),
streams_active_(streams_active),
start_bps_(start_bps),
automatic_resize_(automatic_resize),
expect_scaling_(expect_scaling) {}
private:
void ModifySenderBitrateConfig(BitrateConstraints* bitrate_config) override {
bitrate_config->start_bitrate_bps = start_bps_;
}
size_t GetNumVideoStreams() const override {
return (payload_name_ == "VP9") ? 1 : streams_active_.size();
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
encoder_config->video_format.name = payload_name_;
const VideoCodecType codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->codec_type = codec_type;
encoder_config->max_bitrate_bps =
std::max(start_bps_, encoder_config->max_bitrate_bps);
if (payload_name_ == "VP9") {
// Simulcast layers indicates which spatial layers are active.
encoder_config->simulcast_layers.resize(streams_active_.size());
encoder_config->simulcast_layers[0].max_bitrate_bps =
encoder_config->max_bitrate_bps;
}
double scale_factor = 1.0;
for (int i = streams_active_.size() - 1; i >= 0; --i) {
VideoStream& stream = encoder_config->simulcast_layers[i];
stream.active = streams_active_[i];
stream.scale_resolution_down_by = scale_factor;
scale_factor *= (payload_name_ == "VP9") ? 1.0 : 2.0;
}
SetEncoderSpecific(encoder_config, codec_type, automatic_resize_,
streams_active_.size());
}
void PerformTest() override { EXPECT_EQ(expect_scaling_, Wait()); }
test::FunctionVideoEncoderFactory encoder_factory_;
const std::string payload_name_;
const std::vector<bool> streams_active_;
const int start_bps_;
const bool automatic_resize_;
const bool expect_scaling_;
};
class DownscalingObserver
: public ScalingObserver,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
DownscalingObserver(const std::string& payload_name,
const std::vector<bool>& streams_active,
int start_bps,
bool automatic_resize,
bool expect_downscale)
: ScalingObserver(payload_name,
streams_active,
start_bps,
automatic_resize,
expect_downscale) {}
private:
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
frame_generator_capturer->SetSinkWantsObserver(this);
frame_generator_capturer->ChangeResolution(kInitialWidth, kInitialHeight);
}
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
if (wants.max_pixel_count < kInitialWidth * kInitialHeight)
observation_complete_.Set();
}
};
class UpscalingObserver
: public ScalingObserver,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
UpscalingObserver(const std::string& payload_name,
const std::vector<bool>& streams_active,
int start_bps,
bool automatic_resize,
bool expect_adaptation)
: SendTest(expect_adaptation ? kDefaultTimeoutMs : kTimeoutMs),
encoder_factory_([](const SdpVideoFormat& format)
-> std::unique_ptr<VideoEncoder> {
if (format.name == "VP8")
return VP8Encoder::Create();
if (format.name == "VP9")
return VP9Encoder::Create();
if (format.name == "H264")
return H264Encoder::Create(cricket::VideoCodec("H264"));
RTC_NOTREACHED() << format.name;
return nullptr;
}),
payload_name_(payload_name),
streams_active_(streams_active),
start_bps_(start_bps),
automatic_resize_(automatic_resize),
expect_adaptation_(expect_adaptation) {}
bool expect_upscale)
: ScalingObserver(payload_name,
streams_active,
start_bps,
automatic_resize,
expect_upscale) {}
private:
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
frame_generator_capturer->SetSinkWantsObserver(this);
// Set initial resolution.
frame_generator_capturer->ChangeResolution(kWidth, kHeight);
}
private:
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
frame_generator_capturer->SetSinkWantsObserver(this);
frame_generator_capturer->ChangeResolution(kInitialWidth, kInitialHeight);
}
// Called when FrameGeneratorCapturer::AddOrUpdateSink is called.
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
if (wants.max_pixel_count < kWidth * kHeight)
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
if (wants.max_pixel_count > last_wants_.max_pixel_count) {
if (wants.max_pixel_count == std::numeric_limits<int>::max())
observation_complete_.Set();
}
void ModifySenderBitrateConfig(
BitrateConstraints* bitrate_config) override {
bitrate_config->start_bitrate_bps = start_bps_;
}
last_wants_ = wants;
}
size_t GetNumVideoStreams() const override {
return (payload_name_ == "VP9") ? 1 : streams_active_.size();
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = kVideoSendPayloadType;
encoder_config->video_format.name = payload_name_;
const VideoCodecType codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->codec_type = codec_type;
encoder_config->max_bitrate_bps =
std::max(start_bps_, encoder_config->max_bitrate_bps);
if (payload_name_ == "VP9") {
// Simulcast layers indicates which spatial layers are active.
encoder_config->simulcast_layers.resize(streams_active_.size());
encoder_config->simulcast_layers[0].max_bitrate_bps =
encoder_config->max_bitrate_bps;
}
double scale_factor = 1.0;
for (int i = streams_active_.size() - 1; i >= 0; --i) {
VideoStream& stream = encoder_config->simulcast_layers[i];
stream.active = streams_active_[i];
stream.scale_resolution_down_by = scale_factor;
scale_factor *= (payload_name_ == "VP9") ? 1.0 : 2.0;
}
SetEncoderSpecific(encoder_config, codec_type, automatic_resize_,
streams_active_.size());
}
void PerformTest() override {
EXPECT_EQ(expect_adaptation_, Wait())
<< "Timed out while waiting for a scale down.";
}
test::FunctionVideoEncoderFactory encoder_factory_;
const std::string payload_name_;
const std::vector<bool> streams_active_;
const int start_bps_;
const bool automatic_resize_;
const bool expect_adaptation_;
} test(payload_name, streams_active, start_bps, automatic_resize,
expect_adaptation);
RunBaseTest(&test);
}
rtc::VideoSinkWants last_wants_;
};
TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp8) {
// qp_low:1, qp_high:1 -> kHighQp
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
RunTest("VP8", {true}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP8", {true}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp8) {
// qp_low:1, qp_high:1 -> kHighQp
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
RunTest("VP8", {true}, kHighStartBps,
/*automatic_resize=*/false, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {true}, kHighStartBps,
/*automatic_resize=*/false,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForNormalQp_Vp8) {
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {true}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {true}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp8) {
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {true}, kLowStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP8", {true}, kLowStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrateAndThenUp) {
// qp_low:127, qp_high:127 -> kLowQp
test::ScopedFieldTrials field_trials(kPrefix + "127,127,0,0,0,0" + kEnd);
UpscalingObserver test("VP8", {true}, kDefaultVgaMinStartBps - 1,
/*automatic_resize=*/true, /*expect_upscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrate_Simulcast) {
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {true, true}, kLowStartBps,
/*automatic_resize=*/false, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {true, true}, kLowStartBps,
/*automatic_resize=*/false,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForHighQp_HighestStreamActive_Vp8) {
// qp_low:1, qp_high:1 -> kHighQp
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
RunTest("VP8", {false, false, true}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP8", {false, false, true}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest,
@ -225,18 +276,32 @@ TEST_F(QualityScalingTest,
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {false, false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP8", {false, false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownButNotUpWithMinStartBitrateLimit) {
// qp_low:127, qp_high:127 -> kLowQp
test::ScopedFieldTrials field_trials(kPrefix + "127,127,0,0,0,0" + kEnd);
UpscalingObserver test("VP8", {false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true, /*expect_upscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp8) {
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {false, false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {false, false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest,
@ -246,9 +311,11 @@ TEST_F(QualityScalingTest,
kPrefix + "1,127,0,0,0,0" + kEnd +
"WebRTC-DefaultBitrateLimitsKillSwitch/Enabled/");
RunTest("VP8", {false, false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {false, false, true},
kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest,
@ -256,16 +323,20 @@ TEST_F(QualityScalingTest,
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {true}, kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test(
"VP8", {true}, kSinglecastLimits720pVp8->min_start_bitrate_bps - 1,
/*automatic_resize=*/true, /*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp8) {
// qp_low:1, qp_high:1 -> kHighQp
test::ScopedFieldTrials field_trials(kPrefix + "1,1,0,0,0,0" + kEnd);
RunTest("VP8", {true, false, false}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {true, false, false}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest,
@ -273,16 +344,20 @@ TEST_F(QualityScalingTest,
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {true, false, false}, kLowStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {true, false, false}, kLowStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfScalingOff_Vp8) {
// qp_low:1, qp_high:127 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "1,127,0,0,0,0" + kEnd);
RunTest("VP8", {true}, kLowStartBps,
/*automatic_resize=*/false, /*expect_adaptation=*/false);
DownscalingObserver test("VP8", {true}, kLowStartBps,
/*automatic_resize=*/false,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp9) {
@ -290,8 +365,10 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_Vp9) {
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {true}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP9", {true}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp9) {
@ -299,8 +376,10 @@ TEST_F(QualityScalingTest, NoAdaptDownForHighQpIfScalingOff_Vp9) {
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Disabled/");
RunTest("VP9", {true}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP9", {true}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp9) {
@ -308,8 +387,10 @@ TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp9) {
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {true}, kLowStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP9", {true}, kLowStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp9) {
@ -317,8 +398,10 @@ TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp9) {
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {true, false, false}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP9", {true, false, false}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest,
@ -327,8 +410,10 @@ TEST_F(QualityScalingTest,
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {true, false, false}, kLowStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP9", {true, false, false}, kLowStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForHighQp_MiddleStreamActive_Vp9) {
@ -336,8 +421,10 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_MiddleStreamActive_Vp9) {
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,1,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {false, true, false}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP9", {false, true, false}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest,
@ -346,9 +433,11 @@ TEST_F(QualityScalingTest,
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {false, true, false},
kSinglecastLimits360pVp9->min_start_bitrate_bps - 1,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("VP9", {false, true, false},
kSinglecastLimits360pVp9->min_start_bitrate_bps - 1,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp9) {
@ -356,9 +445,11 @@ TEST_F(QualityScalingTest, NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp9) {
test::ScopedFieldTrials field_trials(kPrefix + "0,0,1,255,0,0" + kEnd +
"WebRTC-VP9QualityScaler/Enabled/");
RunTest("VP9", {false, true, false},
kSinglecastLimits360pVp9->min_start_bitrate_bps,
/*automatic_resize=*/true, /*expect_adaptation=*/false);
DownscalingObserver test("VP9", {false, true, false},
kSinglecastLimits360pVp9->min_start_bitrate_bps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
#if defined(WEBRTC_USE_H264)
@ -366,16 +457,20 @@ TEST_F(QualityScalingTest, AdaptsDownForHighQp_H264) {
// qp_low:1, qp_high:1 -> kHighQp
test::ScopedFieldTrials field_trials(kPrefix + "0,0,0,0,1,1" + kEnd);
RunTest("H264", {true}, kHighStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("H264", {true}, kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_H264) {
// qp_low:1, qp_high:51 -> kNormalQp
test::ScopedFieldTrials field_trials(kPrefix + "0,0,0,0,1,51" + kEnd);
RunTest("H264", {true}, kLowStartBps,
/*automatic_resize=*/true, /*expect_adaptation=*/true);
DownscalingObserver test("H264", {true}, kLowStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/true);
RunBaseTest(&test);
}
#endif // defined(WEBRTC_USE_H264)