Chromium Code Reviews| Index: webrtc/base/network.h |
| diff --git a/webrtc/base/network.h b/webrtc/base/network.h |
| index a41da4a69a0f01f41fd7344ce89d99b6f0e593d2..17c9c9d7475930ba69bfe13c1d5091d8f0228130 100644 |
| --- a/webrtc/base/network.h |
| +++ b/webrtc/base/network.h |
| @@ -37,6 +37,8 @@ class Network; |
| class NetworkMonitorInterface; |
| class Thread; |
| +static const uint16_t kMaxNetworkCost = 999; |
| +static const uint16_t kNetworkCostForUnknownType = 10; |
|
pthatcher1
2016/05/17 20:44:28
I think kNetworkCostMax and kNetworkCostUnknown w
honghaiz3
2016/05/18 05:55:02
Done.
|
| // By default, ignore loopback interfaces on the host. |
| const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK; |
| @@ -346,6 +348,17 @@ class Network { |
| AdapterType type() const { return type_; } |
| void set_type(AdapterType type) { type_ = type; } |
| + uint16_t GetCost() const { |
| + switch (type_) { |
| + case rtc::ADAPTER_TYPE_UNKNOWN: |
| + return kNetworkCostForUnknownType; |
| + case rtc::ADAPTER_TYPE_CELLULAR: |
| + return kMaxNetworkCost; |
|
pthatcher1
2016/05/17 20:44:28
Should we use kNetworkCostHigh == 900 or so just i
honghaiz3
2016/05/18 05:55:02
Done.
I initially chose cellular network cost to b
honghaiz3
2016/05/18 05:55:02
Done.
|
| + default: |
| + return 0; |
|
pthatcher1
2016/05/17 20:44:28
Would a kNetworkCostMin be a good constant?
pthatcher1
2016/05/17 20:44:28
Wouldn't it be better to have the default be "unkn
honghaiz3
2016/05/18 05:55:02
Done. I just listed all types we may have now.
honghaiz3
2016/05/18 05:55:02
Done.
|
| + } |
|
pthatcher1
2016/05/17 20:44:28
Would it make sense to make WiFi kNetworkCostLow =
honghaiz3
2016/05/18 05:55:02
I choose Wifi cost to be 10 to have slightly more
|
| + } |
| + |
| // A unique id assigned by the network manager, which may be signaled |
| // to the remote side in the candidate. |
| uint16_t id() const { return id_; } |