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

Unified Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1987833002: Add a flag to filter out high-cost networks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: merge with head Created 4 years, 7 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/portallocator.h ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 14f7b13212db920adbfd7bc957eb1894ef798e8d..20fc84a38a22fc05eeed1942a1231a1ba94aaf27 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -417,6 +417,19 @@ void BasicPortAllocatorSession::GetNetworks(
network->type();
}),
networks->end());
+
+ if (flags() & PORTALLOCATOR_DISABLE_COSTLY_NETWORKS) {
+ uint16_t lowest_cost = rtc::kNetworkCostMax;
+ for (rtc::Network* network : *networks) {
+ lowest_cost = std::min<uint16_t>(lowest_cost, network->GetCost());
+ }
+ networks->erase(std::remove_if(networks->begin(), networks->end(),
+ [lowest_cost](rtc::Network* network) {
+ return network->GetCost() >
+ lowest_cost + rtc::kNetworkCostLow;
+ }),
+ networks->end());
+ }
}
// For each network, see if we have a sequence that covers it already. If not,
« no previous file with comments | « webrtc/p2p/base/portallocator.h ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698