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

Unified Diff: webrtc/p2p/base/port.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/port.h ('k') | webrtc/p2p/base/port_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/port.cc
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc
index 9207c9d04260433736e51b409f54ab6059c682ed..eba15f69a32a6518766e2a77863d0889c917a02b 100644
--- a/webrtc/p2p/base/port.cc
+++ b/webrtc/p2p/base/port.cc
@@ -242,25 +242,17 @@ void Port::AddAddress(const rtc::SocketAddress& address,
ASSERT(!tcptype.empty());
}
- Candidate c;
- c.set_id(rtc::CreateRandomString(8));
- c.set_component(component_);
- c.set_type(type);
- c.set_protocol(protocol);
+ std::string foundation =
+ ComputeFoundation(type, protocol, relay_protocol, base_address);
+ Candidate c(component_, protocol, address, 0U, username_fragment(), password_,
+ type, generation_, foundation, network_->id(), network_cost_);
+ c.set_priority(
+ c.GetPriority(type_preference, network_->preference(), relay_preference));
c.set_relay_protocol(relay_protocol);
c.set_tcptype(tcptype);
- c.set_address(address);
- c.set_priority(c.GetPriority(type_preference, network_->preference(),
- relay_preference));
- c.set_username(username_fragment());
- c.set_password(password_);
c.set_network_name(network_->name());
c.set_network_type(network_->type());
- c.set_network_cost(network_cost_);
- c.set_generation(generation_);
c.set_related_address(related_address);
- c.set_foundation(
- ComputeFoundation(type, protocol, relay_protocol, base_address));
candidates_.push_back(c);
SignalCandidateReady(this, c);
@@ -705,11 +697,10 @@ class ConnectionRequest : public StunRequest {
static_cast<uint32_t>(connection_->pings_since_last_response_.size() -
1)));
}
- uint32_t network_cost = connection_->port()->network_cost();
- if (network_cost > 0) {
- request->AddAttribute(
- new StunUInt32Attribute(STUN_ATTR_NETWORK_COST, network_cost));
- }
+ uint32_t network_info = connection_->port()->Network()->id();
+ network_info = (network_info << 16) | connection_->port()->network_cost();
+ request->AddAttribute(
+ new StunUInt32Attribute(STUN_ATTR_NETWORK_INFO, network_info));
// Adding ICE_CONTROLLED or ICE_CONTROLLING attribute based on the role.
if (connection_->port()->GetIceRole() == ICEROLE_CONTROLLING) {
@@ -1412,11 +1403,12 @@ void Connection::MaybeAddPrflxCandidate(ConnectionRequest* request,
new_local_candidate.set_password(local_candidate().password());
new_local_candidate.set_network_name(local_candidate().network_name());
new_local_candidate.set_network_type(local_candidate().network_type());
- new_local_candidate.set_network_cost(local_candidate().network_cost());
new_local_candidate.set_related_address(local_candidate().address());
new_local_candidate.set_foundation(ComputeFoundation(
PRFLX_PORT_TYPE, local_candidate().protocol(),
local_candidate().relay_protocol(), local_candidate().address()));
+ new_local_candidate.set_network_id(local_candidate().network_id());
+ new_local_candidate.set_network_cost(local_candidate().network_cost());
// Change the local candidate of this Connection to the new prflx candidate.
local_candidate_index_ = port_->AddPrflxCandidate(new_local_candidate);
« no previous file with comments | « webrtc/p2p/base/port.h ('k') | webrtc/p2p/base/port_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698