Chromium Code Reviews| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 description->ToString(sdp); | 179 description->ToString(sdp); |
| 180 *type = description->type(); | 180 *type = description->type(); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Converter functions from WebKit types to WebRTC types. | 184 // Converter functions from WebKit types to WebRTC types. |
| 185 | 185 |
| 186 void GetNativeRtcConfiguration( | 186 void GetNativeRtcConfiguration( |
| 187 const blink::WebRTCConfiguration& blink_config, | 187 const blink::WebRTCConfiguration& blink_config, |
| 188 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) { | 188 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) { |
| 189 DCHECK_EQ(webrtc_config->enable_localhost_ice_candidate, false); | 189 if (blink_config.isNull() || !webrtc_config) |
|
tommi (sloooow) - chröme
2015/10/23 16:00:23
the webrtc_config wasn't allowed to be null before
| |
| 190 | |
| 191 // When we don't have WebRTCConfiguration, treat it as a special case where we | |
| 192 // should generate local host candidate. This will only be honored if | |
| 193 // enable_multiple_routes is disabled. | |
| 194 if (blink_config.isNull()) { | |
| 195 webrtc_config->enable_localhost_ice_candidate = true; | |
| 196 return; | 190 return; |
| 197 } | 191 for (size_t i = 0; i < blink_config.numberOfServers(); ++i) { |
|
tommi (sloooow) - chröme
2015/10/23 16:00:23
nit: add an empty line above this one for readabil
| |
| 198 | 192 webrtc::PeerConnectionInterface::IceServer server; |
| 199 if (blink_config.iceServers().isNull()) { | 193 const blink::WebRTCICEServer& webkit_server = |
| 200 // Same as when iceServers is undefined or unspecified. | 194 blink_config.server(i); |
| 201 webrtc_config->enable_localhost_ice_candidate = true; | 195 server.username = |
| 202 } else { | 196 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username())); |
| 203 for (size_t i = 0; i < blink_config.iceServers().numberOfServers(); ++i) { | 197 server.password = |
| 204 webrtc::PeerConnectionInterface::IceServer server; | 198 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential())); |
| 205 const blink::WebRTCICEServer& webkit_server = | 199 server.uri = webkit_server.uri().spec(); |
| 206 blink_config.iceServers().server(i); | 200 webrtc_config->servers.push_back(server); |
| 207 server.username = | |
| 208 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username())); | |
| 209 server.password = | |
| 210 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential())); | |
| 211 server.uri = webkit_server.uri().spec(); | |
| 212 webrtc_config->servers.push_back(server); | |
| 213 } | |
| 214 } | 201 } |
| 215 | 202 |
| 216 switch (blink_config.iceTransports()) { | 203 switch (blink_config.iceTransports()) { |
| 217 case blink::WebRTCIceTransportsNone: | 204 case blink::WebRTCIceTransportsNone: |
| 218 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; | 205 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; |
| 219 break; | 206 break; |
| 220 case blink::WebRTCIceTransportsRelay: | 207 case blink::WebRTCIceTransportsRelay: |
| 221 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; | 208 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; |
| 222 break; | 209 break; |
| 223 case blink::WebRTCIceTransportsAll: | 210 case blink::WebRTCIceTransportsAll: |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1670 } | 1657 } |
| 1671 | 1658 |
| 1672 void RTCPeerConnectionHandler::ResetUMAStats() { | 1659 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1673 DCHECK(thread_checker_.CalledOnValidThread()); | 1660 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1674 num_local_candidates_ipv6_ = 0; | 1661 num_local_candidates_ipv6_ = 0; |
| 1675 num_local_candidates_ipv4_ = 0; | 1662 num_local_candidates_ipv4_ = 0; |
| 1676 ice_connection_checking_start_ = base::TimeTicks(); | 1663 ice_connection_checking_start_ = base::TimeTicks(); |
| 1677 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1664 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1678 } | 1665 } |
| 1679 } // namespace content | 1666 } // namespace content |
| OLD | NEW |