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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); | 148 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); |
149 } | 149 } |
150 | 150 |
151 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, | 151 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, |
152 int64_t rtt, | 152 int64_t rtt, |
153 int lost_packets) { | 153 int lost_packets) { |
154 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); | 154 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); |
155 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { | 155 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { |
156 if (!rampup_uma_stats_updated_[i] && | 156 if (!rampup_uma_stats_updated_[i] && |
157 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { | 157 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { |
158 RTC_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, | 158 RTC_LOGGED_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, |
159 now_ms - first_report_time_ms_); | 159 now_ms - first_report_time_ms_); |
160 rampup_uma_stats_updated_[i] = true; | 160 rampup_uma_stats_updated_[i] = true; |
161 } | 161 } |
162 } | 162 } |
163 if (IsInStartPhase(now_ms)) { | 163 if (IsInStartPhase(now_ms)) { |
164 initially_lost_packets_ += lost_packets; | 164 initially_lost_packets_ += lost_packets; |
165 } else if (uma_update_state_ == kNoUpdate) { | 165 } else if (uma_update_state_ == kNoUpdate) { |
166 uma_update_state_ = kFirstDone; | 166 uma_update_state_ = kFirstDone; |
167 bitrate_at_2_seconds_kbps_ = bitrate_kbps; | 167 bitrate_at_2_seconds_kbps_ = bitrate_kbps; |
168 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitiallyLostPackets", | 168 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitiallyLostPackets", |
169 initially_lost_packets_, 0, 100, 50); | 169 initially_lost_packets_, 0, 100, 50); |
170 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, | 170 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), |
171 2000, 50); | 171 0, 2000, 50); |
172 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", | 172 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", |
173 bitrate_at_2_seconds_kbps_, 0, 2000, 50); | 173 bitrate_at_2_seconds_kbps_, 0, 2000, 50); |
174 } else if (uma_update_state_ == kFirstDone && | 174 } else if (uma_update_state_ == kFirstDone && |
175 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { | 175 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { |
176 uma_update_state_ = kDone; | 176 uma_update_state_ = kDone; |
177 int bitrate_diff_kbps = | 177 int bitrate_diff_kbps = |
178 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); | 178 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); |
179 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, | 179 RTC_LOGGED_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", |
180 0, 2000, 50); | 180 bitrate_diff_kbps, 0, 2000, 50); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { | 184 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { |
185 // We trust the REMB and/or delay-based estimate during the first 2 seconds if | 185 // We trust the REMB and/or delay-based estimate during the first 2 seconds if |
186 // we haven't had any packet loss reported, to allow startup bitrate probing. | 186 // we haven't had any packet loss reported, to allow startup bitrate probing. |
187 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) { | 187 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) { |
188 uint32_t prev_bitrate = bitrate_; | 188 uint32_t prev_bitrate = bitrate_; |
189 if (bwe_incoming_ > bitrate_) | 189 if (bwe_incoming_ > bitrate_) |
190 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); | 190 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 bitrate = min_bitrate_configured_; | 299 bitrate = min_bitrate_configured_; |
300 } | 300 } |
301 return bitrate; | 301 return bitrate; |
302 } | 302 } |
303 | 303 |
304 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { | 304 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { |
305 event_log_ = event_log; | 305 event_log_ = event_log; |
306 } | 306 } |
307 | 307 |
308 } // namespace webrtc | 308 } // namespace webrtc |
OLD | NEW |