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

Side by Side Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 1321543002: Enable generation of local host candidate when RTCConfiguration is null. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/rtc_peer_connection_handler.h" 5 #include "content/renderer/media/rtc_peer_connection_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 description->ToString(sdp); 178 description->ToString(sdp);
179 *type = description->type(); 179 *type = description->type();
180 } 180 }
181 } 181 }
182 182
183 // Converter functions from WebKit types to WebRTC types. 183 // Converter functions from WebKit types to WebRTC types.
184 184
185 void GetNativeRtcConfiguration( 185 void GetNativeRtcConfiguration(
186 const blink::WebRTCConfiguration& blink_config, 186 const blink::WebRTCConfiguration& blink_config,
187 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) { 187 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) {
188 if (blink_config.isNull() || !webrtc_config) 188 DCHECK_EQ(webrtc_config->enable_localhost_ice_candidate, false);
189
190 // When we don't have WebRTCConfiguration, treat it as a special case where we
191 // should generate local host candidate. This will only be honored if
192 // enable_multiple_routes is disabled.
193 if (blink_config.isNull()) {
194 webrtc_config->enable_localhost_ice_candidate = true;
189 return; 195 return;
190 for (size_t i = 0; i < blink_config.numberOfServers(); ++i) { 196 }
191 webrtc::PeerConnectionInterface::IceServer server; 197
192 const blink::WebRTCICEServer& webkit_server = 198 if (blink_config.iceServers().isNull()) {
193 blink_config.server(i); 199 // Same as when iceServers is undefined or unspecified.
194 server.username = 200 webrtc_config->enable_localhost_ice_candidate = true;
195 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username())); 201 } else {
196 server.password = 202 for (size_t i = 0; i < blink_config.iceServers().numberOfServers(); ++i) {
197 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential())); 203 webrtc::PeerConnectionInterface::IceServer server;
198 server.uri = webkit_server.uri().spec(); 204 const blink::WebRTCICEServer& webkit_server =
199 webrtc_config->servers.push_back(server); 205 blink_config.iceServers().server(i);
206 server.username =
207 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username()));
208 server.password =
209 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential()));
210 server.uri = webkit_server.uri().spec();
211 webrtc_config->servers.push_back(server);
212 }
200 } 213 }
201 214
202 switch (blink_config.iceTransports()) { 215 switch (blink_config.iceTransports()) {
203 case blink::WebRTCIceTransportsNone: 216 case blink::WebRTCIceTransportsNone:
204 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; 217 webrtc_config->type = webrtc::PeerConnectionInterface::kNone;
205 break; 218 break;
206 case blink::WebRTCIceTransportsRelay: 219 case blink::WebRTCIceTransportsRelay:
207 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; 220 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay;
208 break; 221 break;
209 case blink::WebRTCIceTransportsAll: 222 case blink::WebRTCIceTransportsAll:
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1627 }
1615 1628
1616 void RTCPeerConnectionHandler::ResetUMAStats() { 1629 void RTCPeerConnectionHandler::ResetUMAStats() {
1617 DCHECK(thread_checker_.CalledOnValidThread()); 1630 DCHECK(thread_checker_.CalledOnValidThread());
1618 num_local_candidates_ipv6_ = 0; 1631 num_local_candidates_ipv6_ = 0;
1619 num_local_candidates_ipv4_ = 0; 1632 num_local_candidates_ipv4_ = 0;
1620 ice_connection_checking_start_ = base::TimeTicks(); 1633 ice_connection_checking_start_ = base::TimeTicks();
1621 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); 1634 memset(ice_state_seen_, 0, sizeof(ice_state_seen_));
1622 } 1635 }
1623 } // namespace content 1636 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698