Index: webrtc/p2p/client/basicportallocator.cc |
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc |
index 143b036183777875730387f85736ed71ad90e3db..141ee9aa5dcc565d6d7c6cea5a69e90a80b96227 100644 |
--- a/webrtc/p2p/client/basicportallocator.cc |
+++ b/webrtc/p2p/client/basicportallocator.cc |
@@ -393,6 +393,21 @@ void BasicPortAllocatorSession::GetNetworks( |
network->type(); |
}), |
networks->end()); |
+ |
+ if (flags() & PORTALLOCATOR_GATHER_LOW_COST_NETWORK_ONLY) { |
+ uint16_t lowest_cost = rtc::kMaxNetworkCost; |
+ for (rtc::Network* network : *networks) { |
+ uint16_t cost = network->GetCost(); |
+ if (cost < lowest_cost) { |
+ lowest_cost = cost; |
+ } |
+ } |
pthatcher1
2016/05/17 20:44:28
std::min might work here
honghaiz3
2016/05/18 05:55:02
Done.
|
+ networks->erase(std::remove_if(networks->begin(), networks->end(), |
+ [lowest_cost](rtc::Network* network) { |
+ return network->GetCost() > lowest_cost; |
+ }), |
+ networks->end()); |
pthatcher1
2016/05/17 20:44:28
We could use a threshold greater than zero (perhap
honghaiz3
2016/05/18 05:55:02
Done.
|
+ } |
} |
// For each network, see if we have a sequence that covers it already. If not, |