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

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

Issue 1944003002: Increase the stun ping interval. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 9822eb4c495139f77e795088db717f12bcbc9d7a..85871e4920d0a1a670a9613bb9ad3b670fb4fbf3 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -210,9 +210,9 @@ namespace cricket {
// well on a 28.8K modem, which is the slowest connection on which the voice
// quality is reasonable at all.
static const int PING_PACKET_SIZE = 60 * 8;
-// STRONG_PING_INTERVAL (480ms) is applied when the best connection is both
-// writable and receiving.
-static const int STRONG_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 1000;
+// STRONG_PING_INTERVAL (2400ms) is applied to the Writable connections in the
+// channel when the best connection is both writable and receiving.
+static const int STRONG_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 200;
Taylor Brandstetter 2016/05/04 17:58:08 I don't think the strong ping interval should chan
// WEAK_PING_INTERVAL (48ms) is applied when the best connection is either not
// writable or not receiving.
const int WEAK_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 10000;
@@ -220,7 +220,7 @@ const int WEAK_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 10000;
// If the current best connection is both writable and receiving, then we will
// also try hard to make sure it is pinged at this rate (a little less than
// 2 * STRONG_PING_INTERVAL).
-static const int MAX_CURRENT_STRONG_INTERVAL = 900; // ms
+static const int MAX_CURRENT_STRONG_INTERVAL = 4500; // ms
Taylor Brandstetter 2016/05/04 17:58:08 This can probably change to 2500 though.
static const int MIN_CHECK_RECEIVING_INTERVAL = 50; // ms
@@ -1281,16 +1281,17 @@ void P2PTransportChannel::OnCheckAndPing() {
// Make sure the states of the connections are up-to-date (since this affects
// which ones are pingable).
UpdateConnectionStates();
- // When the best connection is either not receiving or not writable,
- // switch to weak ping interval.
- int ping_interval = weak() ? weak_ping_interval_ : STRONG_PING_INTERVAL;
- if (rtc::TimeMillis() >= last_ping_sent_ms_ + ping_interval) {
+
+ if (rtc::TimeMillis() >= last_ping_sent_ms_ + weak_ping_interval_) {
honghaiz3 2016/05/03 19:15:22 Now after I see this, I realize it will ping all c
honghaiz3 2016/05/03 19:59:17 I think you remove the if condition here and take
Taylor Brandstetter 2016/05/04 17:58:08 I think the strong ping interval (if it stays ~500
Connection* conn = FindNextPingableConnection();
if (conn) {
PingConnection(conn);
MarkConnectionPinged(conn);
}
}
+ // When the best connection is either not receiving or not writable,
+ // switch to weak ping interval.
+ int ping_interval = weak() ? weak_ping_interval_ : STRONG_PING_INTERVAL;
int delay = std::min(ping_interval, check_receiving_interval_);
thread()->PostDelayed(delay, this, MSG_CHECK_AND_PING);
}
@@ -1326,12 +1327,18 @@ bool P2PTransportChannel::IsPingable(Connection* conn, int64_t now) {
return true;
}
+ // Writable connections are ping at a slower rate.
+ if (conn->writable()) {
honghaiz3 2016/05/03 19:15:22 You may need to move this after the backupconnecti
+ return now >= conn->last_ping_sent() + STRONG_PING_INTERVAL;
Taylor Brandstetter 2016/05/04 17:58:08 If STRONG_PING_INTERVAL is changed back to 500ms,
+ }
+
// Always ping active connections regardless whether the channel is completed
// or not, but backup connections are pinged at a slower rate.
if (IsBackupConnection(conn)) {
return (now >= conn->last_ping_response_received() +
config_.backup_connection_ping_interval);
}
+
return conn->active();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698