Collect packet loss and RTT stats of STUN binding requests.
STUN candidates use STUN binding requests to keep NAT bindings open.
Related stats including packet loss and RTT can be now collected via the
legacy GetStats in PeerConnection.
Bug: None
Change-Id: I7b0eee1ccb07eb670a32ee303c9590047b25f31c
Reviewed-on: https://webrtc-review.googlesource.com/54100
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22113}
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index a052c17..8371543 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -183,6 +183,8 @@
// TODO(hbos): |RTCStatsCollector| only collects candidates that are part of
// ice candidate pairs, but there could be candidates not paired with anything.
// crbug.com/632723
+// TODO(qingsi): Add the stats of STUN binding requests (keepalives) and collect
+// them in the new PeerConnection::GetStats.
class RTCIceCandidateStats : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
diff --git a/api/statstypes.cc b/api/statstypes.cc
index d1637e3..8a87265 100644
--- a/api/statstypes.cc
+++ b/api/statstypes.cc
@@ -430,7 +430,9 @@
case kStatsValueNameBandwidthLimitedResolution:
return "googBandwidthLimitedResolution";
// STUN ping related attributes.
+ //
// TODO(zhihuang) Rename these stats to follow the standards.
+ // Connectivity checks.
case kStatsValueNameSentPingRequestsTotal:
return "requestsSent";
case kStatsValueNameSentPingRequestsBeforeFirstResponse:
@@ -441,6 +443,15 @@
return "requestsReceived";
case kStatsValueNameRecvPingResponses:
return "responsesReceived";
+ // STUN Keepalive pings.
+ case kStatsValueNameSentStunKeepaliveRequests:
+ return "stunKeepaliveRequestsSent";
+ case kStatsValueNameRecvStunKeepaliveResponses:
+ return "stunKeepaliveResponsesReceived";
+ case kStatsValueNameStunKeepaliveRttTotal:
+ return "stunKeepaliveRttTotal";
+ case kStatsValueNameStunKeepaliveRttSquaredTotal:
+ return "stunKeepaliveRttSquaredTotal";
// Candidate related attributes. Values are taken from
// http://w3c.github.io/webrtc-stats/#rtcstatstype-enum*.
diff --git a/api/statstypes.h b/api/statstypes.h
index 2ba8ba5..9dc6154 100644
--- a/api/statstypes.h
+++ b/api/statstypes.h
@@ -129,6 +129,10 @@
kStatsValueNameSentPingResponses,
kStatsValueNameRecvPingRequests,
kStatsValueNameRecvPingResponses,
+ kStatsValueNameSentStunKeepaliveRequests,
+ kStatsValueNameRecvStunKeepaliveResponses,
+ kStatsValueNameStunKeepaliveRttTotal,
+ kStatsValueNameStunKeepaliveRttSquaredTotal,
// Internal StatsValue names.
kStatsValueNameAccelerateRate,