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

Unified Diff: webrtc/p2p/base/port.h

Issue 1668073002: Add network cost as part of the connection comparison. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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
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,

Powered by Google App Engine
This is Rietveld 408576698