| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); | 139 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, | 142 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, |
| 143 int64_t rtt, | 143 int64_t rtt, |
| 144 int lost_packets) { | 144 int lost_packets) { |
| 145 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); | 145 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); |
| 146 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { | 146 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { |
| 147 if (!rampup_uma_stats_updated_[i] && | 147 if (!rampup_uma_stats_updated_[i] && |
| 148 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { | 148 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { |
| 149 RTC_HISTOGRAM_COUNTS_100000(kUmaRampupMetrics[i].metric_name, | 149 RTC_HISTOGRAM_COUNTS_SPARSE_100000(kUmaRampupMetrics[i].metric_name, |
| 150 now_ms - first_report_time_ms_); | 150 now_ms - first_report_time_ms_); |
| 151 rampup_uma_stats_updated_[i] = true; | 151 rampup_uma_stats_updated_[i] = true; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 if (IsInStartPhase(now_ms)) { | 154 if (IsInStartPhase(now_ms)) { |
| 155 initially_lost_packets_ += lost_packets; | 155 initially_lost_packets_ += lost_packets; |
| 156 } else if (uma_update_state_ == kNoUpdate) { | 156 } else if (uma_update_state_ == kNoUpdate) { |
| 157 uma_update_state_ = kFirstDone; | 157 uma_update_state_ = kFirstDone; |
| 158 bitrate_at_2_seconds_kbps_ = bitrate_kbps; | 158 bitrate_at_2_seconds_kbps_ = bitrate_kbps; |
| 159 RTC_HISTOGRAM_COUNTS( | 159 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitiallyLostPackets", |
| 160 "WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50); | 160 initially_lost_packets_, 0, 100, 50); |
| 161 RTC_HISTOGRAM_COUNTS( | 161 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), |
| 162 "WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, 2000, 50); | 162 0, 2000, 50); |
| 163 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", | 163 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialBandwidthEstimate", |
| 164 bitrate_at_2_seconds_kbps_, | 164 bitrate_at_2_seconds_kbps_, 0, 2000, 50); |
| 165 0, | |
| 166 2000, | |
| 167 50); | |
| 168 } else if (uma_update_state_ == kFirstDone && | 165 } else if (uma_update_state_ == kFirstDone && |
| 169 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { | 166 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { |
| 170 uma_update_state_ = kDone; | 167 uma_update_state_ = kDone; |
| 171 int bitrate_diff_kbps = | 168 int bitrate_diff_kbps = |
| 172 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); | 169 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); |
| 173 RTC_HISTOGRAM_COUNTS( | 170 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff", |
| 174 "WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, 0, 2000, 50); | 171 bitrate_diff_kbps, 0, 2000, 50); |
| 175 } | 172 } |
| 176 } | 173 } |
| 177 | 174 |
| 178 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { | 175 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { |
| 179 // We trust the REMB during the first 2 seconds if we haven't had any | 176 // We trust the REMB during the first 2 seconds if we haven't had any |
| 180 // packet loss reported, to allow startup bitrate probing. | 177 // packet loss reported, to allow startup bitrate probing. |
| 181 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms) && | 178 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms) && |
| 182 bwe_incoming_ > bitrate_) { | 179 bwe_incoming_ > bitrate_) { |
| 183 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); | 180 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); |
| 184 min_bitrate_history_.clear(); | 181 min_bitrate_history_.clear(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 bitrate = min_bitrate_configured_; | 282 bitrate = min_bitrate_configured_; |
| 286 } | 283 } |
| 287 return bitrate; | 284 return bitrate; |
| 288 } | 285 } |
| 289 | 286 |
| 290 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { | 287 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { |
| 291 event_log_ = event_log; | 288 event_log_ = event_log; |
| 292 } | 289 } |
| 293 | 290 |
| 294 } // namespace webrtc | 291 } // namespace webrtc |
| OLD | NEW |