Replace field trials with WebRtcKeyValueConfig in SendSideBandwidthEstimate
And ad field trial flag to be able to disable RttBasedBackoff Bug: webrtc:10335 Change-Id: Ib67d3e75787daed96e22b2c732f6839e23e4abda Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191967 Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org> Commit-Queue: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32566}
This commit is contained in:
parent
9c99b7964f
commit
9dfe2fce9a
@ -157,6 +157,7 @@ rtc_library("loss_based_controller") {
|
||||
deps = [
|
||||
"../../../api/rtc_event_log",
|
||||
"../../../api/transport:network_control",
|
||||
"../../../api/transport:webrtc_key_value_config",
|
||||
"../../../api/units:data_rate",
|
||||
"../../../api/units:time_delta",
|
||||
"../../../api/units:timestamp",
|
||||
@ -292,6 +293,7 @@ if (rtc_include_tests) {
|
||||
"../../../rtc_base:rtc_base_tests_utils",
|
||||
"../../../rtc_base/experiments:alr_experiment",
|
||||
"../../../system_wrappers",
|
||||
"../../../test:explicit_key_value_config",
|
||||
"../../../test:field_trial",
|
||||
"../../../test:test_support",
|
||||
"../../../test/scenario",
|
||||
|
||||
@ -96,7 +96,8 @@ GoogCcNetworkController::GoogCcNetworkController(NetworkControllerConfig config,
|
||||
key_value_config_)
|
||||
: nullptr),
|
||||
bandwidth_estimation_(
|
||||
std::make_unique<SendSideBandwidthEstimation>(event_log_)),
|
||||
std::make_unique<SendSideBandwidthEstimation>(key_value_config_,
|
||||
event_log_)),
|
||||
alr_detector_(
|
||||
std::make_unique<AlrDetector>(key_value_config_, config.event_log)),
|
||||
probe_bitrate_estimator_(new ProbeBitrateEstimator(config.event_log)),
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/rtc_event_log/rtc_event.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "api/transport/webrtc_key_value_config.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -153,19 +155,24 @@ DataRate LinkCapacityTracker::estimate() const {
|
||||
return DataRate::BitsPerSec(capacity_estimate_bps_);
|
||||
}
|
||||
|
||||
RttBasedBackoff::RttBasedBackoff()
|
||||
: rtt_limit_("limit", TimeDelta::Seconds(3)),
|
||||
RttBasedBackoff::RttBasedBackoff(const WebRtcKeyValueConfig* key_value_config)
|
||||
: disabled_("Disabled"),
|
||||
configured_limit_("limit", TimeDelta::Seconds(3)),
|
||||
drop_fraction_("fraction", 0.8),
|
||||
drop_interval_("interval", TimeDelta::Seconds(1)),
|
||||
bandwidth_floor_("floor", DataRate::KilobitsPerSec(5)),
|
||||
rtt_limit_(TimeDelta::PlusInfinity()),
|
||||
// By initializing this to plus infinity, we make sure that we never
|
||||
// trigger rtt backoff unless packet feedback is enabled.
|
||||
last_propagation_rtt_update_(Timestamp::PlusInfinity()),
|
||||
last_propagation_rtt_(TimeDelta::Zero()),
|
||||
last_packet_sent_(Timestamp::MinusInfinity()) {
|
||||
ParseFieldTrial(
|
||||
{&rtt_limit_, &drop_fraction_, &drop_interval_, &bandwidth_floor_},
|
||||
field_trial::FindFullName("WebRTC-Bwe-MaxRttLimit"));
|
||||
ParseFieldTrial({&disabled_, &configured_limit_, &drop_fraction_,
|
||||
&drop_interval_, &bandwidth_floor_},
|
||||
key_value_config->Lookup("WebRTC-Bwe-MaxRttLimit"));
|
||||
if (!disabled_) {
|
||||
rtt_limit_ = configured_limit_.Get();
|
||||
}
|
||||
}
|
||||
|
||||
void RttBasedBackoff::UpdatePropagationRtt(Timestamp at_time,
|
||||
@ -186,8 +193,11 @@ TimeDelta RttBasedBackoff::CorrectedRtt(Timestamp at_time) const {
|
||||
|
||||
RttBasedBackoff::~RttBasedBackoff() = default;
|
||||
|
||||
SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log)
|
||||
: lost_packets_since_last_loss_update_(0),
|
||||
SendSideBandwidthEstimation::SendSideBandwidthEstimation(
|
||||
const WebRtcKeyValueConfig* key_value_config,
|
||||
RtcEventLog* event_log)
|
||||
: rtt_backoff_(key_value_config),
|
||||
lost_packets_since_last_loss_update_(0),
|
||||
expected_packets_since_last_loss_update_(0),
|
||||
current_target_(DataRate::Zero()),
|
||||
last_logged_target_(DataRate::Zero()),
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/transport/network_types.h"
|
||||
#include "api/transport/webrtc_key_value_config.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/units/timestamp.h"
|
||||
@ -54,17 +55,19 @@ class LinkCapacityTracker {
|
||||
|
||||
class RttBasedBackoff {
|
||||
public:
|
||||
RttBasedBackoff();
|
||||
explicit RttBasedBackoff(const WebRtcKeyValueConfig* key_value_config);
|
||||
~RttBasedBackoff();
|
||||
void UpdatePropagationRtt(Timestamp at_time, TimeDelta propagation_rtt);
|
||||
TimeDelta CorrectedRtt(Timestamp at_time) const;
|
||||
|
||||
FieldTrialParameter<TimeDelta> rtt_limit_;
|
||||
FieldTrialFlag disabled_;
|
||||
FieldTrialParameter<TimeDelta> configured_limit_;
|
||||
FieldTrialParameter<double> drop_fraction_;
|
||||
FieldTrialParameter<TimeDelta> drop_interval_;
|
||||
FieldTrialParameter<DataRate> bandwidth_floor_;
|
||||
|
||||
public:
|
||||
TimeDelta rtt_limit_;
|
||||
Timestamp last_propagation_rtt_update_;
|
||||
TimeDelta last_propagation_rtt_;
|
||||
Timestamp last_packet_sent_;
|
||||
@ -73,7 +76,8 @@ class RttBasedBackoff {
|
||||
class SendSideBandwidthEstimation {
|
||||
public:
|
||||
SendSideBandwidthEstimation() = delete;
|
||||
explicit SendSideBandwidthEstimation(RtcEventLog* event_log);
|
||||
SendSideBandwidthEstimation(const WebRtcKeyValueConfig* key_value_config,
|
||||
RtcEventLog* event_log);
|
||||
~SendSideBandwidthEstimation();
|
||||
|
||||
void OnRouteChange();
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include "api/rtc_event_log/rtc_event.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
|
||||
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
||||
#include "test/explicit_key_value_config.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -36,7 +37,8 @@ MATCHER(LossBasedBweUpdateWithBitrateAndLossFraction, "") {
|
||||
|
||||
void TestProbing(bool use_delay_based) {
|
||||
::testing::NiceMock<MockRtcEventLog> event_log;
|
||||
SendSideBandwidthEstimation bwe(&event_log);
|
||||
test::ExplicitKeyValueConfig key_value_config("");
|
||||
SendSideBandwidthEstimation bwe(&key_value_config, &event_log);
|
||||
int64_t now_ms = 0;
|
||||
bwe.SetMinMaxBitrate(DataRate::BitsPerSec(100000),
|
||||
DataRate::BitsPerSec(1500000));
|
||||
@ -88,7 +90,8 @@ TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
|
||||
EXPECT_CALL(event_log,
|
||||
LogProxy(LossBasedBweUpdateWithBitrateAndLossFraction()))
|
||||
.Times(1);
|
||||
SendSideBandwidthEstimation bwe(&event_log);
|
||||
test::ExplicitKeyValueConfig key_value_config("");
|
||||
SendSideBandwidthEstimation bwe(&key_value_config, &event_log);
|
||||
static const int kMinBitrateBps = 100000;
|
||||
static const int kInitialBitrateBps = 1000000;
|
||||
int64_t now_ms = 1000;
|
||||
@ -138,7 +141,8 @@ TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
|
||||
|
||||
TEST(SendSideBweTest, SettingSendBitrateOverridesDelayBasedEstimate) {
|
||||
::testing::NiceMock<MockRtcEventLog> event_log;
|
||||
SendSideBandwidthEstimation bwe(&event_log);
|
||||
test::ExplicitKeyValueConfig key_value_config("");
|
||||
SendSideBandwidthEstimation bwe(&key_value_config, &event_log);
|
||||
static const int kMinBitrateBps = 10000;
|
||||
static const int kMaxBitrateBps = 10000000;
|
||||
static const int kInitialBitrateBps = 300000;
|
||||
@ -163,4 +167,17 @@ TEST(SendSideBweTest, SettingSendBitrateOverridesDelayBasedEstimate) {
|
||||
EXPECT_EQ(bwe.target_rate().bps(), kForcedHighBitrate);
|
||||
}
|
||||
|
||||
TEST(RttBasedBackoff, DefaultEnabled) {
|
||||
test::ExplicitKeyValueConfig key_value_config("");
|
||||
RttBasedBackoff rtt_backoff(&key_value_config);
|
||||
EXPECT_TRUE(rtt_backoff.rtt_limit_.IsFinite());
|
||||
}
|
||||
|
||||
TEST(RttBasedBackoff, CanBeDisabled) {
|
||||
test::ExplicitKeyValueConfig key_value_config(
|
||||
"WebRTC-Bwe-MaxRttLimit/Disabled/");
|
||||
RttBasedBackoff rtt_backoff(&key_value_config);
|
||||
EXPECT_TRUE(rtt_backoff.rtt_limit_.IsPlusInfinity());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user