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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); | 161 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); |
162 } | 162 } |
163 | 163 |
164 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, | 164 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, |
165 int64_t rtt, | 165 int64_t rtt, |
166 int lost_packets) { | 166 int lost_packets) { |
167 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); | 167 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); |
168 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { | 168 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { |
169 if (!rampup_uma_stats_updated_[i] && | 169 if (!rampup_uma_stats_updated_[i] && |
170 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { | 170 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { |
171 RTC_LOGGED_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, | 171 RTC_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, |
172 now_ms - first_report_time_ms_); | 172 now_ms - first_report_time_ms_); |
173 rampup_uma_stats_updated_[i] = true; | 173 rampup_uma_stats_updated_[i] = true; |
174 } | 174 } |
175 } | 175 } |
176 if (IsInStartPhase(now_ms)) { | 176 if (IsInStartPhase(now_ms)) { |
177 initially_lost_packets_ += lost_packets; | 177 initially_lost_packets_ += lost_packets; |
178 } else if (uma_update_state_ == kNoUpdate) { | 178 } else if (uma_update_state_ == kNoUpdate) { |
179 uma_update_state_ = kFirstDone; | 179 uma_update_state_ = kFirstDone; |
180 bitrate_at_2_seconds_kbps_ = bitrate_kbps; | 180 bitrate_at_2_seconds_kbps_ = bitrate_kbps; |
181 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitiallyLostPackets", | 181 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitiallyLostPackets", |
182 initially_lost_packets_, 0, 100, 50); | 182 initially_lost_packets_, 0, 100, 50); |
183 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), | 183 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, |
184 0, 2000, 50); | 184 2000, 50); |
185 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", | 185 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", |
186 bitrate_at_2_seconds_kbps_, 0, 2000, 50); | 186 bitrate_at_2_seconds_kbps_, 0, 2000, 50); |
187 } else if (uma_update_state_ == kFirstDone && | 187 } else if (uma_update_state_ == kFirstDone && |
188 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { | 188 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { |
189 uma_update_state_ = kDone; | 189 uma_update_state_ = kDone; |
190 int bitrate_diff_kbps = | 190 int bitrate_diff_kbps = |
191 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); | 191 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); |
192 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", | 192 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, |
193 bitrate_diff_kbps, 0, 2000, 50); | 193 0, 2000, 50); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { | 197 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { |
198 // We trust the REMB and/or delay-based estimate during the first 2 seconds if | 198 // We trust the REMB and/or delay-based estimate during the first 2 seconds if |
199 // we haven't had any packet loss reported, to allow startup bitrate probing. | 199 // we haven't had any packet loss reported, to allow startup bitrate probing. |
200 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) { | 200 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) { |
201 uint32_t prev_bitrate = bitrate_; | 201 uint32_t prev_bitrate = bitrate_; |
202 if (bwe_incoming_ > bitrate_) | 202 if (bwe_incoming_ > bitrate_) |
203 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); | 203 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000 | 306 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000 |
307 << " kbps is below configured min bitrate " | 307 << " kbps is below configured min bitrate " |
308 << min_bitrate_configured_ / 1000 << " kbps."; | 308 << min_bitrate_configured_ / 1000 << " kbps."; |
309 last_low_bitrate_log_ms_ = now_ms; | 309 last_low_bitrate_log_ms_ = now_ms; |
310 } | 310 } |
311 bitrate = min_bitrate_configured_; | 311 bitrate = min_bitrate_configured_; |
312 } | 312 } |
313 return bitrate; | 313 return bitrate; |
314 } | 314 } |
315 } // namespace webrtc | 315 } // namespace webrtc |
OLD | NEW |