Make ExtraICEPing send slightly fewer extras

This patch introduces a minor tweak to how often
the extra ice pings are sent.
- never send if non of the candidates is relay
- only send (extra) if it was more than 100ms
  since you sent a ping.

The motivation for this is that we measured
an regression of 0.05% in call setup success rate.

Bug: webrtc:10273
Change-Id: Icff36297d57030853a9ff8d4f74aaf6c84051d26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132702
Reviewed-by: Jeroen de Borst <jeroendb@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27601}
This commit is contained in:
Jonas Oreland
2019-04-12 10:02:31 +02:00
committed by Commit Bot
parent 249b321785
commit 330fbee5d8

View File

@ -155,6 +155,8 @@ const int RTT_RATIO = 3; // 3 : 1
// it to a little higher than a total STUN timeout. // it to a little higher than a total STUN timeout.
const int kPortTimeoutDelay = cricket::STUN_TOTAL_TIMEOUT + 5000; const int kPortTimeoutDelay = cricket::STUN_TOTAL_TIMEOUT + 5000;
constexpr int64_t kMinExtraPingDelayMs = 100;
} // namespace } // namespace
namespace cricket { namespace cricket {
@ -1331,8 +1333,26 @@ void Connection::HandleBindingRequest(IceMessage* msg) {
ReceivedPing(); ReceivedPing();
if (webrtc::field_trial::IsEnabled("WebRTC-ExtraICEPing") && if (webrtc::field_trial::IsEnabled("WebRTC-ExtraICEPing") &&
last_ping_response_received_ == 0) { last_ping_response_received_ == 0) {
RTC_LOG(LS_INFO) << ToString() << "WebRTC-ExtraICEPing/Sending extra ping"; if (local_candidate().type() == RELAY_PORT_TYPE ||
Ping(rtc::TimeMillis()); local_candidate().type() == PRFLX_PORT_TYPE ||
remote_candidate().type() == RELAY_PORT_TYPE ||
remote_candidate().type() == PRFLX_PORT_TYPE) {
const int64_t now = rtc::TimeMillis();
if (last_ping_sent_ + kMinExtraPingDelayMs <= now) {
RTC_LOG(LS_INFO) << ToString()
<< "WebRTC-ExtraICEPing/Sending extra ping"
<< " last_ping_sent_: " << last_ping_sent_
<< " now: " << now
<< " (diff: " << (now - last_ping_sent_) << ")";
Ping(now);
} else {
RTC_LOG(LS_INFO) << ToString()
<< "WebRTC-ExtraICEPing/Not sending extra ping"
<< " last_ping_sent_: " << last_ping_sent_
<< " now: " << now
<< " (diff: " << (now - last_ping_sent_) << ")";
}
}
} }
const rtc::SocketAddress& remote_addr = remote_candidate_.address(); const rtc::SocketAddress& remote_addr = remote_candidate_.address();