Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 constexpr int kInitialRateWindowMs = 500; | 41 constexpr int kInitialRateWindowMs = 500; |
| 42 constexpr int kRateWindowMs = 150; | 42 constexpr int kRateWindowMs = 150; |
| 43 | 43 |
| 44 // Parameters for linear least squares fit of regression line to noisy data. | 44 // Parameters for linear least squares fit of regression line to noisy data. |
| 45 constexpr size_t kDefaultTrendlineWindowSize = 20; | 45 constexpr size_t kDefaultTrendlineWindowSize = 20; |
| 46 constexpr double kDefaultTrendlineSmoothingCoeff = 0.9; | 46 constexpr double kDefaultTrendlineSmoothingCoeff = 0.9; |
| 47 constexpr double kDefaultTrendlineThresholdGain = 4.0; | 47 constexpr double kDefaultTrendlineThresholdGain = 4.0; |
| 48 | 48 |
| 49 constexpr int kMaxConsecutiveFailedLookups = 5; | 49 constexpr int kMaxConsecutiveFailedLookups = 5; |
| 50 | 50 |
| 51 const char kBweSparseUpdateExperiment[] = "WebRTC-BweSparseUpdateExperiment"; | |
| 52 | |
| 53 bool BweSparseUpdateExperimentIsEnabled() { | |
| 54 std::string experiment_string = | |
|
michaelt
2017/04/24 07:00:52
nit:
how about use "experiment_status" instead of
| |
| 55 webrtc::field_trial::FindFullName(kBweSparseUpdateExperiment); | |
| 56 return experiment_string == "Enabled"; | |
| 57 } | |
| 51 | 58 |
| 52 class PacketFeedbackComparator { | 59 class PacketFeedbackComparator { |
| 53 public: | 60 public: |
| 54 inline bool operator()(const webrtc::PacketFeedback& lhs, | 61 inline bool operator()(const webrtc::PacketFeedback& lhs, |
| 55 const webrtc::PacketFeedback& rhs) { | 62 const webrtc::PacketFeedback& rhs) { |
| 56 if (lhs.arrival_time_ms != rhs.arrival_time_ms) | 63 if (lhs.arrival_time_ms != rhs.arrival_time_ms) |
| 57 return lhs.arrival_time_ms < rhs.arrival_time_ms; | 64 return lhs.arrival_time_ms < rhs.arrival_time_ms; |
| 58 if (lhs.send_time_ms != rhs.send_time_ms) | 65 if (lhs.send_time_ms != rhs.send_time_ms) |
| 59 return lhs.send_time_ms < rhs.send_time_ms; | 66 return lhs.send_time_ms < rhs.send_time_ms; |
| 60 return lhs.sequence_number < rhs.sequence_number; | 67 return lhs.sequence_number < rhs.sequence_number; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 detector_(), | 161 detector_(), |
| 155 receiver_incoming_bitrate_(), | 162 receiver_incoming_bitrate_(), |
| 156 last_seen_packet_ms_(-1), | 163 last_seen_packet_ms_(-1), |
| 157 uma_recorded_(false), | 164 uma_recorded_(false), |
| 158 probe_bitrate_estimator_(event_log), | 165 probe_bitrate_estimator_(event_log), |
| 159 trendline_window_size_(kDefaultTrendlineWindowSize), | 166 trendline_window_size_(kDefaultTrendlineWindowSize), |
| 160 trendline_smoothing_coeff_(kDefaultTrendlineSmoothingCoeff), | 167 trendline_smoothing_coeff_(kDefaultTrendlineSmoothingCoeff), |
| 161 trendline_threshold_gain_(kDefaultTrendlineThresholdGain), | 168 trendline_threshold_gain_(kDefaultTrendlineThresholdGain), |
| 162 consecutive_delayed_feedbacks_(0), | 169 consecutive_delayed_feedbacks_(0), |
| 163 last_logged_bitrate_(0), | 170 last_logged_bitrate_(0), |
| 164 last_logged_state_(BandwidthUsage::kBwNormal) { | 171 last_logged_state_(BandwidthUsage::kBwNormal), |
| 172 in_sparse_update_experiment_(BweSparseUpdateExperimentIsEnabled()) { | |
| 165 LOG(LS_INFO) << "Using Trendline filter for delay change estimation."; | 173 LOG(LS_INFO) << "Using Trendline filter for delay change estimation."; |
| 166 | |
| 167 network_thread_.DetachFromThread(); | 174 network_thread_.DetachFromThread(); |
| 168 } | 175 } |
| 169 | 176 |
| 170 DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector( | 177 DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector( |
| 171 const std::vector<PacketFeedback>& packet_feedback_vector) { | 178 const std::vector<PacketFeedback>& packet_feedback_vector) { |
| 172 RTC_DCHECK(network_thread_.CalledOnValidThread()); | 179 RTC_DCHECK(network_thread_.CalledOnValidThread()); |
| 173 | 180 |
| 174 std::vector<PacketFeedback> sorted_packet_feedback_vector; | 181 std::vector<PacketFeedback> sorted_packet_feedback_vector; |
| 175 SortPacketFeedbackVector(packet_feedback_vector, | 182 SortPacketFeedbackVector(packet_feedback_vector, |
| 176 &sorted_packet_feedback_vector); | 183 &sorted_packet_feedback_vector); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 188 BweNames::kBweNamesMax); | 195 BweNames::kBweNamesMax); |
| 189 uma_recorded_ = true; | 196 uma_recorded_ = true; |
| 190 } | 197 } |
| 191 bool overusing = false; | 198 bool overusing = false; |
| 192 bool delayed_feedback = true; | 199 bool delayed_feedback = true; |
| 193 for (const auto& packet_feedback : sorted_packet_feedback_vector) { | 200 for (const auto& packet_feedback : sorted_packet_feedback_vector) { |
| 194 if (packet_feedback.send_time_ms < 0) | 201 if (packet_feedback.send_time_ms < 0) |
| 195 continue; | 202 continue; |
| 196 delayed_feedback = false; | 203 delayed_feedback = false; |
| 197 IncomingPacketFeedback(packet_feedback); | 204 IncomingPacketFeedback(packet_feedback); |
| 198 overusing |= detector_.State() == BandwidthUsage::kBwOverusing; | 205 if (!in_sparse_update_experiment_) |
| 206 overusing |= (detector_.State() == BandwidthUsage::kBwOverusing); | |
| 199 } | 207 } |
| 208 if (in_sparse_update_experiment_) | |
| 209 overusing = (detector_.State() == BandwidthUsage::kBwOverusing); | |
| 200 if (delayed_feedback) { | 210 if (delayed_feedback) { |
| 201 ++consecutive_delayed_feedbacks_; | 211 ++consecutive_delayed_feedbacks_; |
| 202 if (consecutive_delayed_feedbacks_ >= kMaxConsecutiveFailedLookups) { | 212 if (consecutive_delayed_feedbacks_ >= kMaxConsecutiveFailedLookups) { |
| 203 consecutive_delayed_feedbacks_ = 0; | 213 consecutive_delayed_feedbacks_ = 0; |
| 204 return OnLongFeedbackDelay( | 214 return OnLongFeedbackDelay( |
| 205 sorted_packet_feedback_vector.back().arrival_time_ms); | 215 sorted_packet_feedback_vector.back().arrival_time_ms); |
| 206 } | 216 } |
| 207 } else { | 217 } else { |
| 208 consecutive_delayed_feedbacks_ = 0; | 218 consecutive_delayed_feedbacks_ = 0; |
| 209 return MaybeUpdateEstimate(overusing); | 219 return MaybeUpdateEstimate(overusing); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { | 365 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { |
| 356 // Called from both the configuration thread and the network thread. Shouldn't | 366 // Called from both the configuration thread and the network thread. Shouldn't |
| 357 // be called from the network thread in the future. | 367 // be called from the network thread in the future. |
| 358 rate_control_.SetMinBitrate(min_bitrate_bps); | 368 rate_control_.SetMinBitrate(min_bitrate_bps); |
| 359 } | 369 } |
| 360 | 370 |
| 361 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { | 371 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { |
| 362 return rate_control_.GetExpectedBandwidthPeriodMs(); | 372 return rate_control_.GetExpectedBandwidthPeriodMs(); |
| 363 } | 373 } |
| 364 } // namespace webrtc | 374 } // namespace webrtc |
| OLD | NEW |