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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.cc

Issue 1815473002: Add 16-bit network id to the candidate signaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Remove the old NETWORK_COST attribute. Created 4 years, 9 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
« no previous file with comments | « webrtc/p2p/base/candidate.h ('k') | webrtc/p2p/base/port.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 759fd461db20f4fd67f52a7575ed359a4dec2b18..e0428d638312b464ce9bc0fc72fdd3f3bfd669b5 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -614,25 +614,30 @@ 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);
+ }
// 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
« no previous file with comments | « webrtc/p2p/base/candidate.h ('k') | webrtc/p2p/base/port.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698