Index: webrtc/p2p/base/p2ptransportchannel.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
index 759fd461db20f4fd67f52a7575ed359a4dec2b18..49c3ca4e5a961d17e6c7187126be5950c0851382 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel.cc |
@@ -614,25 +614,36 @@ void P2PTransportChannel::OnUnknownAddress( |
} |
int remote_candidate_priority = priority_attr->value(); |
- const StunUInt32Attribute* cost_attr = |
- stun_msg->GetUInt32(STUN_ATTR_NETWORK_COST); |
- uint32_t network_cost = (cost_attr) ? cost_attr->value() : 0; |
+ uint16_t network_id = 0; |
+ uint16_t network_cost = 0; |
+ const StunUInt32Attribute* network_attr = |
+ stun_msg->GetUInt32(STUN_ATTR_NETWORK_INFO); |
+ if (network_attr) { |
+ uint32_t network_info = network_attr->value(); |
+ network_id = static_cast<uint16_t>(network_info >> 16); |
+ network_cost = static_cast<uint16_t>(network_info); |
+ } else { |
+ // TODO(honghaiz): Delete this once no client sends this attribute. |
+ const StunUInt32Attribute* cost_attr = |
+ stun_msg->GetUInt32(STUN_ATTR_NETWORK_COST); |
+ network_cost = |
+ (cost_attr) ? static_cast<uint16_t>(cost_attr->value()) : 0; |
pthatcher1
2016/03/21 17:49:24
Why can't we just have it be the same attribute, b
honghaiz3
2016/03/22 16:30:03
If a new client talks to an old client, the old c
pthatcher1
2016/03/22 21:12:09
I think since the network cost is signalled, and t
honghaiz3
2016/03/23 18:59:33
Done.
|
+ } |
// RFC 5245 |
// If the source transport address of the request does not match any |
// existing remote candidates, it represents a new peer reflexive remote |
// candidate. |
- remote_candidate = Candidate(component(), ProtoToString(proto), address, 0, |
- remote_username, remote_password, |
- PRFLX_PORT_TYPE, remote_generation, ""); |
+ remote_candidate = Candidate( |
+ component(), ProtoToString(proto), address, remote_candidate_priority, |
+ remote_username, remote_password, PRFLX_PORT_TYPE, remote_generation, |
+ "", network_id, network_cost); |
// From RFC 5245, section-7.2.1.3: |
// The foundation of the candidate is set to an arbitrary value, different |
// from the foundation for all other remote candidates. |
remote_candidate.set_foundation( |
rtc::ToString<uint32_t>(rtc::ComputeCrc32(remote_candidate.id()))); |
- remote_candidate.set_priority(remote_candidate_priority); |
- remote_candidate.set_network_cost(network_cost); |
} |
// RFC5245, the agent constructs a pair whose local candidate is equal to |