Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit c35a6be

Browse files
committed
Field trials of bitrate control follows field trial convention. (#91)
1 parent e76c694 commit c35a6be

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

modules/congestion_controller/goog_cc/goog_cc_network_control.cc

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ GoogCcNetworkController::GoogCcNetworkController(NetworkControllerConfig config,
165165
DataRate::Zero())),
166166
max_padding_rate_(config.stream_based_config.max_padding_rate.value_or(
167167
DataRate::Zero())),
168-
max_total_allocated_bitrate_(DataRate::Zero()) {
168+
max_total_allocated_bitrate_(DataRate::Zero()),
169+
external_start_bitrate_kbps_("start", 0),
170+
external_min_bitrate_kbps_("min", 0),
171+
external_max_bitrate_kbps_("max", 0) {
169172
RTC_DCHECK(config.constraints.at_time.IsFinite());
170173
ParseFieldTrial(
171174
{&safe_reset_on_route_change_, &safe_reset_acknowledged_rate_},
@@ -175,21 +178,26 @@ GoogCcNetworkController::GoogCcNetworkController(NetworkControllerConfig config,
175178
if (delay_based_bwe_gcc_)
176179
delay_based_bwe_gcc_->SetMinBitrate(congestion_controller::GetMinBitrate());
177180
if (AllowExternalBwe()) {
178-
if (GetExternalBweRateLimits(&external_start_bitrate_kbps_,
179-
&external_min_bitrate_kbps_,
180-
&external_max_bitrate_kbps_)) {
181-
if (external_start_bitrate_kbps_ > 0)
182-
delay_based_bwe_->SetStartBitrate(
183-
webrtc::DataRate::BitsPerSec(external_start_bitrate_kbps_ * 1024));
184-
if (external_min_bitrate_kbps_ > 0)
185-
delay_based_bwe_->SetMinBitrate(
186-
webrtc::DataRate::BitsPerSec(external_min_bitrate_kbps_ * 1024));
181+
ParseFieldTrial({&external_start_bitrate_kbps_, &external_min_bitrate_kbps_,
182+
&external_max_bitrate_kbps_},
183+
field_trial::FindFullName("OWT-Bwe-RateLimits"));
184+
RTC_CHECK_GE(external_start_bitrate_kbps_.Get(), 0)
185+
<< "start_bitrate_kbps must not be smaller than 0.";
186+
RTC_CHECK_GE(external_min_bitrate_kbps_.Get(), 0)
187+
<< " min_bitrate_kbps must not be smaller than 0.";
188+
RTC_CHECK_GE(external_max_bitrate_kbps_.Get(), 0)
189+
<< "max_bitrate_kbps must not be smaller than 0";
190+
if (external_start_bitrate_kbps_.Get() > 0)
191+
delay_based_bwe_->SetStartBitrate(
192+
webrtc::DataRate::BitsPerSec(external_start_bitrate_kbps_ * 1024));
193+
if (external_min_bitrate_kbps_.Get() > 0)
194+
delay_based_bwe_->SetMinBitrate(
195+
webrtc::DataRate::BitsPerSec(external_min_bitrate_kbps_ * 1024));
187196
#ifdef INTEL_GPRA
188-
// Only intel_gpra module allows setting maxbitrate.
189-
if (external_max_bitrate_kbps_ > 0)
190-
delay_based_bwe_->SetMaxBitrate(external_max_bitrate_kbps_ * 1024);
197+
// Only intel_gpra module allows setting maxbitrate.
198+
if (external_max_bitrate_kbps_.Get() > 0)
199+
delay_based_bwe_->SetMaxBitrate(external_max_bitrate_kbps_ * 1024);
191200
#endif
192-
}
193201
}
194202
}
195203

modules/congestion_controller/goog_cc/goog_cc_network_control.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ class GoogCcNetworkController : public NetworkControllerInterface {
154154
bool previously_in_alr_ = false;
155155

156156
absl::optional<DataSize> current_data_window_;
157+
FieldTrialParameter<int> external_start_bitrate_kbps_;
158+
FieldTrialParameter<int> external_min_bitrate_kbps_;
159+
FieldTrialParameter<int> external_max_bitrate_kbps_;
160+
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GoogCcNetworkController);
157161
};
158162

159163
} // namespace webrtc

0 commit comments

Comments
 (0)