QualityScalingTest: Use EncoderStreamFactory instead of test::DefaultVideoStreamFactory

For example, QualityScalingTest.NoAdaptDownForLowStartBitrateIfBitrateEnough_Vp9 would now catch issues as in e.g. webrtc:14499

Add additional test: NoAdaptDownForHighStartBitrate_Vp9 (HD singlecast, default QP thresholds).


Bug: webrtc:14499
Change-Id: I0e6a447c34befb7cfc3116b1ee9d0ff44824b0c0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/277640
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38271}
This commit is contained in:
Åsa Persson 2022-10-03 09:10:55 +02:00 committed by WebRTC LUCI CQ
parent 5778e01bb4
commit 0f51bf739b

View File

@ -19,6 +19,7 @@
#include "test/call_test.h"
#include "test/field_trial.h"
#include "test/frame_generator_capturer.h"
#include "video/config/encoder_stream_factory.h"
namespace webrtc {
namespace {
@ -122,12 +123,17 @@ class ScalingObserver : public test::SendTest {
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
VideoEncoder::EncoderInfo encoder_info;
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->video_stream_factory =
rtc::make_ref_counted<cricket::EncoderStreamFactory>(
payload_name_, /*max_qp=*/0, /*is_screenshare=*/false,
/*conference_mode=*/false, encoder_info);
encoder_config->max_bitrate_bps =
std::max(start_bps_, encoder_config->max_bitrate_bps);
if (payload_name_ == "VP9") {
@ -472,6 +478,15 @@ TEST_F(QualityScalingTest, AdaptsDownForLowStartBitrate_Vp9) {
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForHighStartBitrate_Vp9) {
DownscalingObserver test(
"VP9", {{.active = false}, {.active = false}, {.active = true}},
kHighStartBps,
/*automatic_resize=*/true,
/*expect_downscale=*/false);
RunBaseTest(&test);
}
TEST_F(QualityScalingTest, NoAdaptDownForHighQp_LowestStreamActive_Vp9) {
// qp_low:1, qp_high:1 -> kHighQp
test::ScopedKeyValueConfig field_trials(field_trials_,