Add field trial for ExtraICEPing
This patch adds a field trial for sending an extra ice ping
when receiving a ice ping and we have not received an ice ping
response. The theory is that this will decrease time it takes
for a connection to become writable and improve behavior with
ice reroutes (choosing a new ice candidate pair).
Bug: webrtc:10273
Change-Id: I98d442649869e7c7655edbbb5ab42c596f5d3b9d
Reviewed-on: https://webrtc-review.googlesource.com/c/120722
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26503}
diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc
index 5d1b73f..62be347 100644
--- a/p2p/base/p2p_transport_channel.cc
+++ b/p2p/base/p2p_transport_channel.cc
@@ -631,6 +631,10 @@
<< config.stun_keepalive_interval_or_default();
}
+ if (webrtc::field_trial::IsEnabled("WebRTC-ExtraICEPing")) {
+ RTC_LOG(LS_INFO) << "Set WebRTC-ExtraICEPing: Enabled";
+ }
+
webrtc::BasicRegatheringController::Config regathering_config(
config_.regather_all_networks_interval_range,
config_.regather_on_failed_networks_interval_or_default());
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index 238becb..d6d402e 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -30,6 +30,7 @@
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/third_party/base64/base64.h"
+#include "system_wrappers/include/field_trial.h"
namespace {
@@ -1328,6 +1329,11 @@
void Connection::HandleBindingRequest(IceMessage* msg) {
// This connection should now be receiving.
ReceivedPing();
+ if (webrtc::field_trial::IsEnabled("WebRTC-ExtraICEPing") &&
+ last_ping_response_received_ == 0) {
+ RTC_LOG(LS_INFO) << ToString() << "WebRTC-ExtraICEPing/Sending extra ping";
+ Ping(rtc::TimeMillis());
+ }
const rtc::SocketAddress& remote_addr = remote_candidate_.address();
const std::string& remote_ufrag = remote_candidate_.username();