summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstefan@webrtc.org <stefan@webrtc.org>2014-11-04 19:32:10 +0000
committerstefan@webrtc.org <stefan@webrtc.org>2014-11-04 19:32:10 +0000
commit4706c9639d883916b8ed35a1f40f6327162f51b4 (patch)
treefbe260c7e5f5d0bd9e4686b0b7e2d6ed7586f598
parent9a8c28f10f329c5ce91e77057933e60224000627 (diff)
downloadwebrtc-4706c9639d883916b8ed35a1f40f6327162f51b4.tar.gz
Add UMA for measuring the diff between the BWE at 2 seconds compared to the BWE at 20 seconds when the BWE should have converged.
BUG=crbug/425925 R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/30819005 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7620 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--modules/bitrate_controller/send_side_bandwidth_estimation.cc31
-rw-r--r--modules/bitrate_controller/send_side_bandwidth_estimation.h7
2 files changed, 31 insertions, 7 deletions
diff --git a/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/modules/bitrate_controller/send_side_bandwidth_estimation.cc
index 47a79ad2..9b55dad7 100644
--- a/modules/bitrate_controller/send_side_bandwidth_estimation.cc
+++ b/modules/bitrate_controller/send_side_bandwidth_estimation.cc
@@ -22,6 +22,7 @@ enum { kBweDecreaseIntervalMs = 300 };
enum { kLimitNumPackets = 20 };
enum { kAvgPacketSizeBytes = 1000 };
enum { kStartPhaseMs = 2000 };
+enum { kBweConverganceTimeMs = 20000 };
// Calculate the rate that TCP-Friendly Rate Control (TFRC) would apply.
// The formula in RFC 3448, Section 3.1, is used.
@@ -61,7 +62,8 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation()
time_last_decrease_ms_(0),
first_report_time_ms_(-1),
initially_lost_packets_(0),
- uma_updated_(false) {
+ bitrate_at_2_seconds_kbps_(0),
+ uma_update_state_(kNoUpdate) {
}
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
@@ -130,18 +132,35 @@ void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
if (first_report_time_ms_ == -1) {
first_report_time_ms_ = now_ms;
- } else if (IsInStartPhase(now_ms)) {
- initially_lost_packets_ += (fraction_loss * number_of_packets) >> 8;
- } else if (!uma_updated_) {
- uma_updated_ = true;
+ } else {
+ UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8);
+ }
+}
+
+void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
+ int rtt,
+ int lost_packets) {
+ if (IsInStartPhase(now_ms)) {
+ initially_lost_packets_ += lost_packets;
+ } else if (uma_update_state_ == kNoUpdate) {
+ uma_update_state_ = kFirstDone;
+ bitrate_at_2_seconds_kbps_ = (bitrate_ + 500) / 1000;
RTC_HISTOGRAM_COUNTS(
"WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50);
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", rtt, 0, 2000, 50);
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate",
- (bitrate_ + 500) / 1000,
+ 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_ - static_cast<int>((bitrate_ + 500) / 1000),
+ 0);
+ RTC_HISTOGRAM_COUNTS(
+ "WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, 0, 2000, 50);
}
}
diff --git a/modules/bitrate_controller/send_side_bandwidth_estimation.h b/modules/bitrate_controller/send_side_bandwidth_estimation.h
index 0fe3ae67..3361904b 100644
--- a/modules/bitrate_controller/send_side_bandwidth_estimation.h
+++ b/modules/bitrate_controller/send_side_bandwidth_estimation.h
@@ -43,8 +43,12 @@ class SendSideBandwidthEstimation {
void SetMinBitrate(uint32_t min_bitrate);
private:
+ enum UmaState { kNoUpdate, kFirstDone, kDone };
+
bool IsInStartPhase(int64_t now_ms) const;
+ void UpdateUmaStats(int64_t now_ms, int rtt, int lost_packets);
+
// Returns the input bitrate capped to the thresholds defined by the max,
// min and incoming bandwidth.
uint32_t CapBitrateToThresholds(uint32_t bitrate);
@@ -72,7 +76,8 @@ class SendSideBandwidthEstimation {
uint32_t time_last_decrease_ms_;
int64_t first_report_time_ms_;
int initially_lost_packets_;
- bool uma_updated_;
+ int bitrate_at_2_seconds_kbps_;
+ UmaState uma_update_state_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_