summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstefan@webrtc.org <stefan@webrtc.org>2014-11-03 14:42:43 +0000
committerstefan@webrtc.org <stefan@webrtc.org>2014-11-03 14:42:43 +0000
commit389423753c4f3d1716f9838cfdaa29ab2f7dae7d (patch)
tree7b76b90660cafda41282afcf31422efb1c3b34ae
parented94bc8eccb61b3fdffe5af5cdf090c20aefe63b (diff)
downloadwebrtc-389423753c4f3d1716f9838cfdaa29ab2f7dae7d.tar.gz
Add UMA metrics for the initial (after two seconds) packet loss, round-trip time and bandwidth estimate of a WebRTC call.
BUG=crbug/425925 R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/31899004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7593 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.h4
2 files changed, 31 insertions, 4 deletions
diff --git a/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/modules/bitrate_controller/send_side_bandwidth_estimation.cc
index 406322a3..47a79ad2 100644
--- a/modules/bitrate_controller/send_side_bandwidth_estimation.cc
+++ b/modules/bitrate_controller/send_side_bandwidth_estimation.cc
@@ -13,6 +13,7 @@
#include <cmath>
#include "webrtc/system_wrappers/interface/logging.h"
+#include "webrtc/system_wrappers/interface/metrics.h"
namespace webrtc {
namespace {
@@ -20,6 +21,7 @@ enum { kBweIncreaseIntervalMs = 1000 };
enum { kBweDecreaseIntervalMs = 300 };
enum { kLimitNumPackets = 20 };
enum { kAvgPacketSizeBytes = 1000 };
+enum { kStartPhaseMs = 2000 };
// Calculate the rate that TCP-Friendly Rate Control (TFRC) would apply.
// The formula in RFC 3448, Section 3.1, is used.
@@ -57,7 +59,9 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation()
last_round_trip_time_ms_(0),
bwe_incoming_(0),
time_last_decrease_ms_(0),
- first_report_time_ms_(-1) {
+ first_report_time_ms_(-1),
+ initially_lost_packets_(0),
+ uma_updated_(false) {
}
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
@@ -97,8 +101,6 @@ void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
uint32_t rtt,
int number_of_packets,
uint32_t now_ms) {
- if (first_report_time_ms_ == -1)
- first_report_time_ms_ = now_ms;
// Update RTT.
last_round_trip_time_ms_ = rtt;
@@ -125,12 +127,28 @@ void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
}
time_last_receiver_block_ms_ = now_ms;
UpdateEstimate(now_ms);
+
+ 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;
+ 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,
+ 0,
+ 2000,
+ 50);
+ }
}
void SendSideBandwidthEstimation::UpdateEstimate(uint32_t now_ms) {
// We trust the REMB during the first 2 seconds if we haven't had any
// packet loss reported, to allow startup bitrate probing.
- if (last_fraction_loss_ == 0 && now_ms - first_report_time_ms_ < 2000 &&
+ if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms) &&
bwe_incoming_ > bitrate_) {
bitrate_ = CapBitrateToThresholds(bwe_incoming_);
min_bitrate_history_.clear();
@@ -187,6 +205,11 @@ void SendSideBandwidthEstimation::UpdateEstimate(uint32_t now_ms) {
bitrate_ = CapBitrateToThresholds(bitrate_);
}
+bool SendSideBandwidthEstimation::IsInStartPhase(int64_t now_ms) const {
+ return first_report_time_ms_ == -1 ||
+ now_ms - first_report_time_ms_ < kStartPhaseMs;
+}
+
void SendSideBandwidthEstimation::UpdateMinHistory(uint32_t now_ms) {
// Remove old data points from history.
// Since history precision is in ms, add one so it is able to increase
diff --git a/modules/bitrate_controller/send_side_bandwidth_estimation.h b/modules/bitrate_controller/send_side_bandwidth_estimation.h
index 6b323852..0fe3ae67 100644
--- a/modules/bitrate_controller/send_side_bandwidth_estimation.h
+++ b/modules/bitrate_controller/send_side_bandwidth_estimation.h
@@ -43,6 +43,8 @@ class SendSideBandwidthEstimation {
void SetMinBitrate(uint32_t min_bitrate);
private:
+ bool IsInStartPhase(int64_t now_ms) const;
+
// Returns the input bitrate capped to the thresholds defined by the max,
// min and incoming bandwidth.
uint32_t CapBitrateToThresholds(uint32_t bitrate);
@@ -69,6 +71,8 @@ class SendSideBandwidthEstimation {
uint32_t bwe_incoming_;
uint32_t time_last_decrease_ms_;
int64_t first_report_time_ms_;
+ int initially_lost_packets_;
+ bool uma_updated_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_