| Index: net/nqe/network_quality_estimator.cc
|
| diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc
|
| index 96c0f3c92ccac8217bfc93906fa22031ccd95a22..8b55d568e406e9bc4fa1f0ff9a47b52be73b7a40 100644
|
| --- a/net/nqe/network_quality_estimator.cc
|
| +++ b/net/nqe/network_quality_estimator.cc
|
| @@ -363,8 +363,6 @@ NetworkQualityEstimator::NetworkQualityEstimator(
|
| .find(GetEffectiveConnectionTypeAlgorithm(variation_params))
|
| ->second),
|
| tick_clock_(new base::DefaultTickClock()),
|
| - effective_connection_type_recomputation_interval_(
|
| - base::TimeDelta::FromSeconds(15)),
|
| last_connection_change_(tick_clock_->NowTicks()),
|
| current_network_id_(nqe::internal::NetworkID(
|
| NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN,
|
| @@ -374,6 +372,10 @@ NetworkQualityEstimator::NetworkQualityEstimator(
|
| effective_connection_type_at_last_main_frame_(
|
| EFFECTIVE_CONNECTION_TYPE_UNKNOWN),
|
| external_estimate_provider_(std::move(external_estimates_provider)),
|
| + effective_connection_type_recomputation_interval_(
|
| + base::TimeDelta::FromSeconds(15)),
|
| + number_of_rtt_samples_at_last_ect_computation_(0),
|
| + number_of_bandwidth_samples_at_last_ect_computation_(0),
|
| effective_connection_type_(EFFECTIVE_CONNECTION_TYPE_UNKNOWN),
|
| min_signal_strength_since_connection_change_(INT32_MAX),
|
| max_signal_strength_since_connection_change_(INT32_MIN),
|
| @@ -1650,7 +1652,18 @@ void NetworkQualityEstimator::MaybeRecomputeEffectiveConnectionType() {
|
| // has not updated.
|
| if (now - last_effective_connection_type_computation_ <
|
| effective_connection_type_recomputation_interval_ &&
|
| - last_connection_change_ < last_effective_connection_type_computation_) {
|
| + last_connection_change_ < last_effective_connection_type_computation_ &&
|
| + // Recompute the effective connection type if the previously computed
|
| + // effective connection type was unknown.
|
| + effective_connection_type_ != EFFECTIVE_CONNECTION_TYPE_UNKNOWN &&
|
| + // Recompute the effective connection type if the number of samples
|
| + // available now are more than twice in count than the number of
|
| + // samples that were available when the effective connection type was
|
| + // last computed.
|
| + number_of_rtt_samples_at_last_ect_computation_ * 2 >=
|
| + rtt_observations_.Size() &&
|
| + number_of_bandwidth_samples_at_last_ect_computation_ * 2 >=
|
| + downstream_throughput_kbps_observations_.Size()) {
|
| return;
|
| }
|
|
|
| @@ -1660,6 +1673,10 @@ void NetworkQualityEstimator::MaybeRecomputeEffectiveConnectionType() {
|
|
|
| if (past_type != effective_connection_type_)
|
| NotifyObserversOfEffectiveConnectionTypeChanged();
|
| +
|
| + number_of_rtt_samples_at_last_ect_computation_ = rtt_observations_.Size();
|
| + number_of_bandwidth_samples_at_last_ect_computation_ =
|
| + downstream_throughput_kbps_observations_.Size();
|
| }
|
|
|
| void NetworkQualityEstimator::
|
|
|