From f3e9abf6b383a2881eecc5f02876a701a1696668 Mon Sep 17 00:00:00 2001 From: Jonas Oreland Date: Thu, 31 Jan 2019 12:29:41 +0100 Subject: [PATCH] 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 Reviewed-by: Qingsi Wang Cr-Commit-Position: refs/heads/master@{#26503} --- p2p/base/p2p_transport_channel.cc | 4 ++++ p2p/base/port.cc | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc index 5d1b73f92b..62be347838 100644 --- a/p2p/base/p2p_transport_channel.cc +++ b/p2p/base/p2p_transport_channel.cc @@ -631,6 +631,10 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) { << 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 238becbf7b..d6d402ef57 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::OnReadPacket(const char* data, 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();