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

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

Issue 2670053002: Allow applications to limit the ICE check rate through RTCConfiguration (Closed)
Patch Set: CR feedback Created 3 years, 11 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 | « webrtc/p2p/base/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | 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 f47f03bbd64f7276e7887f152941539799c80c22..fc7dce2f9e6ad2d283759757d491b481322ed287 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -71,7 +71,7 @@ static const int PING_PACKET_SIZE = 60 * 8;
// The next two ping intervals are at the channel level.
// STRONG_PING_INTERVAL (480ms) is applied when the selected connection is both
// writable and receiving.
-static const int STRONG_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 1000;
+const int STRONG_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 1000;
// WEAK_PING_INTERVAL (48ms) is applied when the selected connection is either
// not writable or not receiving.
const int WEAK_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 10000;
@@ -430,6 +430,12 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) {
LOG(LS_INFO) << "Set default nomination mode to "
<< static_cast<int>(config_.default_nomination_mode);
}
+
+ if (config_.ice_check_min_interval != config.ice_check_min_interval) {
+ config_.ice_check_min_interval = config.ice_check_min_interval;
+ LOG(LS_INFO) << "Set min ping interval to "
+ << *config_.ice_check_min_interval;
+ }
}
const IceConfig& P2PTransportChannel::config() const {
@@ -1522,8 +1528,8 @@ void P2PTransportChannel::OnCheckAndPing() {
conn->num_pings_sent() < MIN_PINGS_AT_WEAK_PING_INTERVAL;
});
int ping_interval = (weak() || need_more_pings_at_weak_interval)
- ? weak_ping_interval_
- : STRONG_PING_INTERVAL;
+ ? weak_ping_interval()
+ : strong_ping_interval();
if (rtc::TimeMillis() >= last_ping_sent_ms_ + ping_interval) {
Connection* conn = FindNextPingableConnection();
if (conn) {
@@ -1607,7 +1613,7 @@ int P2PTransportChannel::CalculateActiveWritablePingInterval(
// Ping each connection at a higher rate at least
// MIN_PINGS_AT_WEAK_PING_INTERVAL times.
if (conn->num_pings_sent() < MIN_PINGS_AT_WEAK_PING_INTERVAL) {
- return weak_ping_interval_;
+ return weak_ping_interval();
}
int stable_interval = config_.stable_writable_connection_ping_interval;
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698