Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: webrtc/p2p/base/port.cc

Issue 2719523002: RTCIceCandidatePairStats.[total/current]RoundTripTime collected. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/port.cc
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc
index bf57cf956815dc1fafe6f1c7cd8d490e82a431d5..c4d797d2bd850027a205e2b03c86bf06e1b04829 100644
--- a/webrtc/p2p/base/port.cc
+++ b/webrtc/p2p/base/port.cc
@@ -1251,6 +1251,7 @@ void Connection::ReceivedPing() {
}
void Connection::ReceivedPingResponse(int rtt, const std::string& request_id) {
+ RTC_DCHECK_GE(rtt, 0);
// We've already validated that this is a STUN binding response with
// the correct local and remote username for this connection.
// So if we're not already, become writable. We may be bringing a pruned
@@ -1264,6 +1265,16 @@ void Connection::ReceivedPingResponse(int rtt, const std::string& request_id) {
acked_nomination_ = iter->nomination;
}
+ current_round_trip_time_ms_ = rtc::Optional<uint32_t>(
+ static_cast<uint32_t>(rtt));
+ if (!total_round_trip_time_ms_) {
+ total_round_trip_time_ms_ = rtc::Optional<uint64_t>(
+ static_cast<uint64_t>(rtt));
+ } else {
+ total_round_trip_time_ms_ = rtc::Optional<uint64_t>(
+ *total_round_trip_time_ms_ + rtt);
+ }
+
pings_since_last_response_.clear();
last_ping_response_received_ = rtc::TimeMillis();
UpdateReceiving(last_ping_response_received_);
@@ -1503,6 +1514,8 @@ ConnectionInfo Connection::stats() {
stats_.key = this;
stats_.state = state_;
stats_.priority = priority();
+ stats_.total_round_trip_time_ms = total_round_trip_time_ms_;
+ stats_.current_round_trip_time_ms = current_round_trip_time_ms_;
return stats_;
}

Powered by Google App Engine
This is Rietveld 408576698