OLD | NEW |
---|---|
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 Loading... | |
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(webrtc_config); |
189 | |
190 webrtc_config->enable_localhost_ice_candidate = false; | |
tommi (sloooow) - chröme
2015/09/16 19:31:47
It would be OK with me to do this instead:
DCHECK
| |
191 | |
192 // When we don't have WebRTCConfiguration, treat it as a special case where we | |
193 // should generate local host candidate. This will only be honored if | |
194 // enable_multiple_routes is disabled. | |
195 if (blink_config.isNull()) { | |
196 webrtc_config->enable_localhost_ice_candidate = true; | |
189 return; | 197 return; |
190 for (size_t i = 0; i < blink_config.numberOfServers(); ++i) { | 198 } |
191 webrtc::PeerConnectionInterface::IceServer server; | 199 |
192 const blink::WebRTCICEServer& webkit_server = | 200 if (blink_config.iceServers().isNull()) { |
193 blink_config.server(i); | 201 // Same as when iceServers is undefined or unspecified. |
194 server.username = | 202 webrtc_config->enable_localhost_ice_candidate = true; |
195 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username())); | 203 } else { |
196 server.password = | 204 for (size_t i = 0; i < blink_config.iceServers().numberOfServers(); ++i) { |
197 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential())); | 205 webrtc::PeerConnectionInterface::IceServer server; |
198 server.uri = webkit_server.uri().spec(); | 206 const blink::WebRTCICEServer& webkit_server = |
199 webrtc_config->servers.push_back(server); | 207 blink_config.iceServers().server(i); |
208 server.username = | |
209 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username())); | |
210 server.password = | |
211 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential())); | |
212 server.uri = webkit_server.uri().spec(); | |
213 webrtc_config->servers.push_back(server); | |
214 } | |
200 } | 215 } |
201 | 216 |
202 switch (blink_config.iceTransports()) { | 217 switch (blink_config.iceTransports()) { |
203 case blink::WebRTCIceTransportsNone: | 218 case blink::WebRTCIceTransportsNone: |
204 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; | 219 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; |
205 break; | 220 break; |
206 case blink::WebRTCIceTransportsRelay: | 221 case blink::WebRTCIceTransportsRelay: |
207 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; | 222 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; |
208 break; | 223 break; |
209 case blink::WebRTCIceTransportsAll: | 224 case blink::WebRTCIceTransportsAll: |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1614 } | 1629 } |
1615 | 1630 |
1616 void RTCPeerConnectionHandler::ResetUMAStats() { | 1631 void RTCPeerConnectionHandler::ResetUMAStats() { |
1617 DCHECK(thread_checker_.CalledOnValidThread()); | 1632 DCHECK(thread_checker_.CalledOnValidThread()); |
1618 num_local_candidates_ipv6_ = 0; | 1633 num_local_candidates_ipv6_ = 0; |
1619 num_local_candidates_ipv4_ = 0; | 1634 num_local_candidates_ipv4_ = 0; |
1620 ice_connection_checking_start_ = base::TimeTicks(); | 1635 ice_connection_checking_start_ = base::TimeTicks(); |
1621 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1636 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
1622 } | 1637 } |
1623 } // namespace content | 1638 } // namespace content |
OLD | NEW |