webrtc/rtc_base/experiments/bandwidth_quality_scaler_settings_unittest.cc
Shuhai Peng f270770679 video: Implement bandwidth based scaler
The |slice_qp_detla| reported by the hardware is not credible, which
causing the quality scaler cannot work properly,the resolution cannot
be adjusted correctly.

To fix this issue, this CL implements a bandwidth scaler which is used
for adjust resolution, this scaler will be used when QP based quality
scaler is not working due to untrusted QP reported by HW AVC encoder.

Bug: webrtc:12942
Change-Id: I2fc5f07a5400ec7e5ead2c2c502faee84d7f2a76
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228860
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35120}
2021-09-29 10:39:27 +00:00

49 lines
1.8 KiB
C++

/*
* Copyright 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/experiments/bandwidth_quality_scaler_settings.h"
#include "test/field_trial.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
TEST(BandwidthQualityScalerSettingsTest, ValuesNotSetByDefault) {
const auto settings = BandwidthQualityScalerSettings::ParseFromFieldTrials();
EXPECT_FALSE(settings.BitrateStateUpdateInterval());
}
TEST(BandwidthQualityScalerSettingsTest, ParseBitrateStateUpdateInterval) {
test::ScopedFieldTrials field_trials(
"WebRTC-Video-BandwidthQualityScalerSettings/"
"bitrate_state_update_interval_s_:100/");
EXPECT_EQ(100u, BandwidthQualityScalerSettings::ParseFromFieldTrials()
.BitrateStateUpdateInterval());
}
TEST(BandwidthQualityScalerSettingsTest, ParseAll) {
test::ScopedFieldTrials field_trials(
"WebRTC-Video-BandwidthQualityScalerSettings/"
"bitrate_state_update_interval_s_:100/");
EXPECT_EQ(100u, BandwidthQualityScalerSettings::ParseFromFieldTrials()
.BitrateStateUpdateInterval());
}
TEST(BandwidthQualityScalerSettingsTest, DoesNotParseIncorrectValue) {
test::ScopedFieldTrials field_trials(
"WebRTC-Video-BandwidthQualityScalerSettings/"
"bitrate_state_update_interval_s_:??/");
const auto settings = BandwidthQualityScalerSettings::ParseFromFieldTrials();
EXPECT_FALSE(settings.BitrateStateUpdateInterval());
}
} // namespace
} // namespace webrtc