| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 description_callback, | 162 description_callback, |
| 163 std::string* sdp, std::string* type) { | 163 std::string* sdp, std::string* type) { |
| 164 const webrtc::SessionDescriptionInterface* description = | 164 const webrtc::SessionDescriptionInterface* description = |
| 165 description_callback.Run(); | 165 description_callback.Run(); |
| 166 if (description) { | 166 if (description) { |
| 167 description->ToString(sdp); | 167 description->ToString(sdp); |
| 168 *type = description->type(); | 168 *type = description->type(); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Converter functions from WebKit types to libjingle types. | 172 // Converter functions from WebKit types to WebRTC types. |
| 173 | 173 |
| 174 void GetNativeRtcConfiguration( | 174 void GetNativeRtcConfiguration( |
| 175 const blink::WebRTCConfiguration& server_configuration, | 175 const blink::WebRTCConfiguration& blink_config, |
| 176 webrtc::PeerConnectionInterface::RTCConfiguration* config) { | 176 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) { |
| 177 if (server_configuration.isNull() || !config) | 177 if (blink_config.isNull() || !webrtc_config) |
| 178 return; | 178 return; |
| 179 for (size_t i = 0; i < server_configuration.numberOfServers(); ++i) { | 179 for (size_t i = 0; i < blink_config.numberOfServers(); ++i) { |
| 180 webrtc::PeerConnectionInterface::IceServer server; | 180 webrtc::PeerConnectionInterface::IceServer server; |
| 181 const blink::WebRTCICEServer& webkit_server = | 181 const blink::WebRTCICEServer& webkit_server = |
| 182 server_configuration.server(i); | 182 blink_config.server(i); |
| 183 server.username = base::UTF16ToUTF8(webkit_server.username()); | 183 server.username = base::UTF16ToUTF8(webkit_server.username()); |
| 184 server.password = base::UTF16ToUTF8(webkit_server.credential()); | 184 server.password = base::UTF16ToUTF8(webkit_server.credential()); |
| 185 server.uri = webkit_server.uri().spec(); | 185 server.uri = webkit_server.uri().spec(); |
| 186 config->servers.push_back(server); | 186 webrtc_config->servers.push_back(server); |
| 187 } | 187 } |
| 188 | 188 |
| 189 switch (server_configuration.iceTransports()) { | 189 switch (blink_config.iceTransports()) { |
| 190 case blink::WebRTCIceTransportsNone: | 190 case blink::WebRTCIceTransportsNone: |
| 191 config->type = webrtc::PeerConnectionInterface::kNone; | 191 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; |
| 192 break; | 192 break; |
| 193 case blink::WebRTCIceTransportsRelay: | 193 case blink::WebRTCIceTransportsRelay: |
| 194 config->type = webrtc::PeerConnectionInterface::kRelay; | 194 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; |
| 195 break; | 195 break; |
| 196 case blink::WebRTCIceTransportsAll: | 196 case blink::WebRTCIceTransportsAll: |
| 197 config->type = webrtc::PeerConnectionInterface::kAll; | 197 webrtc_config->type = webrtc::PeerConnectionInterface::kAll; |
| 198 break; | 198 break; |
| 199 default: | 199 default: |
| 200 NOTREACHED(); | 200 NOTREACHED(); |
| 201 } |
| 202 |
| 203 switch (blink_config.bundlePolicy()) { |
| 204 case blink::WebRTCBundlePolicyBalanced: |
| 205 webrtc_config->bundle_policy = |
| 206 webrtc::PeerConnectionInterface::kBundlePolicyBalanced; |
| 207 break; |
| 208 case blink::WebRTCBundlePolicyMaxBundle: |
| 209 webrtc_config->bundle_policy = |
| 210 webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle; |
| 211 break; |
| 212 case blink::WebRTCBundlePolicyMaxCompat: |
| 213 webrtc_config->bundle_policy = |
| 214 webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat; |
| 215 break; |
| 216 default: |
| 217 NOTREACHED(); |
| 201 } | 218 } |
| 202 } | 219 } |
| 203 | 220 |
| 204 class SessionDescriptionRequestTracker { | 221 class SessionDescriptionRequestTracker { |
| 205 public: | 222 public: |
| 206 SessionDescriptionRequestTracker( | 223 SessionDescriptionRequestTracker( |
| 207 const base::WeakPtr<RTCPeerConnectionHandler>& handler, | 224 const base::WeakPtr<RTCPeerConnectionHandler>& handler, |
| 208 const base::WeakPtr<PeerConnectionTracker>& tracker, | 225 const base::WeakPtr<PeerConnectionTracker>& tracker, |
| 209 PeerConnectionTracker::Action action) | 226 PeerConnectionTracker::Action action) |
| 210 : handler_(handler), tracker_(tracker), action_(action) {} | 227 : handler_(handler), tracker_(tracker), action_(action) {} |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 base::WaitableEvent event(false, false); | 1476 base::WaitableEvent event(false, false); |
| 1460 thread->PostTask(FROM_HERE, | 1477 thread->PostTask(FROM_HERE, |
| 1461 base::Bind(&RunSynchronousClosure, closure, | 1478 base::Bind(&RunSynchronousClosure, closure, |
| 1462 base::Unretained(trace_event_name), | 1479 base::Unretained(trace_event_name), |
| 1463 base::Unretained(&event))); | 1480 base::Unretained(&event))); |
| 1464 event.Wait(); | 1481 event.Wait(); |
| 1465 } | 1482 } |
| 1466 } | 1483 } |
| 1467 | 1484 |
| 1468 } // namespace content | 1485 } // namespace content |
| OLD | NEW |