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

Side by Side Diff: content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 445933005: Support multiple STUN servers for PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/p2p/port_allocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 network_manager_(network_manager), 122 network_manager_(network_manager),
123 socket_factory_(socket_factory), 123 socket_factory_(socket_factory),
124 web_frame_(web_frame) { 124 web_frame_(web_frame) {
125 } 125 }
126 126
127 virtual cricket::PortAllocator* CreatePortAllocator( 127 virtual cricket::PortAllocator* CreatePortAllocator(
128 const std::vector<StunConfiguration>& stun_servers, 128 const std::vector<StunConfiguration>& stun_servers,
129 const std::vector<TurnConfiguration>& turn_configurations) OVERRIDE { 129 const std::vector<TurnConfiguration>& turn_configurations) OVERRIDE {
130 CHECK(web_frame_); 130 CHECK(web_frame_);
131 P2PPortAllocator::Config config; 131 P2PPortAllocator::Config config;
132 if (stun_servers.size() > 0) { 132 for (size_t i = 0; i < stun_servers.size(); ++i) {
133 config.stun_server = stun_servers[0].server.hostname(); 133 config.stun_servers.insert(rtc::SocketAddress(
134 config.stun_server_port = stun_servers[0].server.port(); 134 stun_servers[i].server.hostname(),
135 stun_servers[i].server.port()));
135 } 136 }
136 config.legacy_relay = false; 137 config.legacy_relay = false;
137 for (size_t i = 0; i < turn_configurations.size(); ++i) { 138 for (size_t i = 0; i < turn_configurations.size(); ++i) {
138 P2PPortAllocator::Config::RelayServerConfig relay_config; 139 P2PPortAllocator::Config::RelayServerConfig relay_config;
139 relay_config.server_address = turn_configurations[i].server.hostname(); 140 relay_config.server_address = turn_configurations[i].server.hostname();
140 relay_config.port = turn_configurations[i].server.port(); 141 relay_config.port = turn_configurations[i].server.port();
141 relay_config.username = turn_configurations[i].username; 142 relay_config.username = turn_configurations[i].username;
142 relay_config.password = turn_configurations[i].password; 143 relay_config.password = turn_configurations[i].password;
143 relay_config.transport_type = turn_configurations[i].transport_type; 144 relay_config.transport_type = turn_configurations[i].transport_type;
144 relay_config.secure = turn_configurations[i].secure; 145 relay_config.secure = turn_configurations[i].secure;
145 config.relays.push_back(relay_config); 146 config.relays.push_back(relay_config);
146 }
147 147
148 // Use first turn server as the stun server. 148 // Use turn servers as stun servers.
149 if (turn_configurations.size() > 0) { 149 config.stun_servers.insert(rtc::SocketAddress(
150 config.stun_server = config.relays[0].server_address; 150 turn_configurations[i].server.hostname(),
151 config.stun_server_port = config.relays[0].port; 151 turn_configurations[i].server.port()));
152 } 152 }
153 153
154 return new P2PPortAllocator( 154 return new P2PPortAllocator(
155 web_frame_, socket_dispatcher_.get(), network_manager_, 155 web_frame_, socket_dispatcher_.get(), network_manager_,
156 socket_factory_, config); 156 socket_factory_, config);
157 } 157 }
158 158
159 protected: 159 protected:
160 virtual ~P2PPortAllocatorFactory() {} 160 virtual ~P2PPortAllocatorFactory() {}
161 161
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 } 656 }
657 657
658 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 658 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
659 if (audio_device_) 659 if (audio_device_)
660 return; 660 return;
661 661
662 audio_device_ = new WebRtcAudioDeviceImpl(); 662 audio_device_ = new WebRtcAudioDeviceImpl();
663 } 663 }
664 664
665 } // namespace content 665 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/p2p/port_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698