diff options
Diffstat (limited to 'webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc')
-rw-r--r-- | webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc index 9fa7b0dfc0..258c4d94de 100644 --- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc +++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc @@ -13,9 +13,10 @@ #include <cmath> #include "webrtc/base/checks.h" +#include "webrtc/base/logging.h" #include "webrtc/system_wrappers/include/field_trial.h" -#include "webrtc/system_wrappers/include/logging.h" #include "webrtc/system_wrappers/include/metrics.h" +#include "webrtc/call/rtc_event_log.h" namespace webrtc { namespace { @@ -59,7 +60,8 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation() initially_lost_packets_(0), bitrate_at_2_seconds_kbps_(0), uma_update_state_(kNoUpdate), - rampup_uma_stats_updated_(kNumUmaRampupMetrics, false) {} + rampup_uma_stats_updated_(kNumUmaRampupMetrics, false), + event_log_(nullptr) {} SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {} @@ -144,8 +146,8 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { if (!rampup_uma_stats_updated_[i] && bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { - RTC_HISTOGRAM_COUNTS_100000(kUmaRampupMetrics[i].metric_name, - now_ms - first_report_time_ms_); + RTC_HISTOGRAM_COUNTS_SPARSE_100000(kUmaRampupMetrics[i].metric_name, + now_ms - first_report_time_ms_); rampup_uma_stats_updated_[i] = true; } } @@ -154,22 +156,19 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, } else if (uma_update_state_ == kNoUpdate) { uma_update_state_ = kFirstDone; bitrate_at_2_seconds_kbps_ = bitrate_kbps; - RTC_HISTOGRAM_COUNTS( - "WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50); - RTC_HISTOGRAM_COUNTS( - "WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, 2000, 50); - RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate", - bitrate_at_2_seconds_kbps_, - 0, - 2000, - 50); + RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitiallyLostPackets", + initially_lost_packets_, 0, 100, 50); + RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialRtt", static_cast<int>(rtt), + 0, 2000, 50); + RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialBandwidthEstimate", + bitrate_at_2_seconds_kbps_, 0, 2000, 50); } else if (uma_update_state_ == kFirstDone && now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { uma_update_state_ = kDone; int bitrate_diff_kbps = std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); - RTC_HISTOGRAM_COUNTS( - "WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, 0, 2000, 50); + RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff", + bitrate_diff_kbps, 0, 2000, 50); } } @@ -206,6 +205,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { // rates). bitrate_ += 1000; + if (event_log_) { + event_log_->LogBwePacketLossEvent( + bitrate_, last_fraction_loss_, + expected_packets_since_last_loss_update_); + } } else if (last_fraction_loss_ <= 26) { // Loss between 2% - 10%: Do nothing. } else { @@ -224,6 +228,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { 512.0); has_decreased_since_last_fraction_loss_ = true; } + if (event_log_) { + event_log_->LogBwePacketLossEvent( + bitrate_, last_fraction_loss_, + expected_packets_since_last_loss_update_); + } } } bitrate_ = CapBitrateToThresholds(now_ms, bitrate_); @@ -274,4 +283,9 @@ uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds( } return bitrate; } + +void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { + event_log_ = event_log; +} + } // namespace webrtc |