| 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 DCHECK(webrtc_config); |
| 190 if (blink_config.isNull()) |
| 191 return; |
| 190 | 192 |
| 191 // When we don't have WebRTCConfiguration, treat it as a special case where we | 193 for (size_t i = 0; i < blink_config.numberOfServers(); ++i) { |
| 192 // should generate local host candidate. This will only be honored if | 194 webrtc::PeerConnectionInterface::IceServer server; |
| 193 // enable_multiple_routes is disabled. | 195 const blink::WebRTCICEServer& webkit_server = |
| 194 if (blink_config.isNull()) { | 196 blink_config.server(i); |
| 195 webrtc_config->enable_localhost_ice_candidate = true; | 197 server.username = |
| 196 return; | 198 base::UTF16ToUTF8(base::StringPiece16(webkit_server.username())); |
| 197 } | 199 server.password = |
| 198 | 200 base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential())); |
| 199 if (blink_config.iceServers().isNull()) { | 201 server.uri = webkit_server.uri().spec(); |
| 200 // Same as when iceServers is undefined or unspecified. | 202 webrtc_config->servers.push_back(server); |
| 201 webrtc_config->enable_localhost_ice_candidate = true; | |
| 202 } else { | |
| 203 for (size_t i = 0; i < blink_config.iceServers().numberOfServers(); ++i) { | |
| 204 webrtc::PeerConnectionInterface::IceServer server; | |
| 205 const blink::WebRTCICEServer& webkit_server = | |
| 206 blink_config.iceServers().server(i); | |
| 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 } | 203 } |
| 215 | 204 |
| 216 switch (blink_config.iceTransports()) { | 205 switch (blink_config.iceTransports()) { |
| 217 case blink::WebRTCIceTransportsNone: | 206 case blink::WebRTCIceTransportsNone: |
| 218 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; | 207 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; |
| 219 break; | 208 break; |
| 220 case blink::WebRTCIceTransportsRelay: | 209 case blink::WebRTCIceTransportsRelay: |
| 221 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; | 210 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; |
| 222 break; | 211 break; |
| 223 case blink::WebRTCIceTransportsAll: | 212 case blink::WebRTCIceTransportsAll: |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 } | 1659 } |
| 1671 | 1660 |
| 1672 void RTCPeerConnectionHandler::ResetUMAStats() { | 1661 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1673 DCHECK(thread_checker_.CalledOnValidThread()); | 1662 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1674 num_local_candidates_ipv6_ = 0; | 1663 num_local_candidates_ipv6_ = 0; |
| 1675 num_local_candidates_ipv4_ = 0; | 1664 num_local_candidates_ipv4_ = 0; |
| 1676 ice_connection_checking_start_ = base::TimeTicks(); | 1665 ice_connection_checking_start_ = base::TimeTicks(); |
| 1677 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1666 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1678 } | 1667 } |
| 1679 } // namespace content | 1668 } // namespace content |
| OLD | NEW |