Index: webrtc/p2p/base/port.h |
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h |
index 436b1e7faafc2993f67e5905a35ef0e56f1f2cf2..95abe86464931e2d4029e0c5ac2c9770f998cc93 100644 |
--- a/webrtc/p2p/base/port.h |
+++ b/webrtc/p2p/base/port.h |
@@ -296,6 +296,7 @@ class Port : public PortInterface, public rtc::MessageHandler, |
void set_candidate_filter(uint32_t candidate_filter) { |
candidate_filter_ = candidate_filter; |
} |
+ int32_t network_cost() const { return network_cost_; } |
protected: |
enum { |
@@ -395,6 +396,11 @@ class Port : public PortInterface, public rtc::MessageHandler, |
// TurnPort will hide raddr to avoid local address leakage. |
uint32_t candidate_filter_; |
+ // A virtual cost perceived by the user, usually based on the network type |
+ // (WiFi. vs. Cellular). It takes precedence over the priority when |
+ // comparing two connections. |
+ uint32_t network_cost_; |
+ |
friend class Connection; |
}; |
@@ -560,6 +566,8 @@ class Connection : public rtc::MessageHandler, |
IceMode remote_ice_mode() const { return remote_ice_mode_; } |
+ uint32_t ComputeNetworkCost() const; |
+ |
// Update the ICE password of the remote candidate if |ice_ufrag| matches |
// the candidate's ufrag, and the candidate's passwrod has not been set. |
void MaybeSetRemoteIceCredentials(const std::string& ice_ufrag, |