| 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.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return WebRTCPeerConnectionHandlerClient::SignalingStateClosed; | 131 return WebRTCPeerConnectionHandlerClient::SignalingStateClosed; |
| 132 default: | 132 default: |
| 133 NOTREACHED(); | 133 NOTREACHED(); |
| 134 return WebRTCPeerConnectionHandlerClient::SignalingStateClosed; | 134 return WebRTCPeerConnectionHandlerClient::SignalingStateClosed; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 blink::WebRTCSessionDescription CreateWebKitSessionDescription( | 138 blink::WebRTCSessionDescription CreateWebKitSessionDescription( |
| 139 const std::string& sdp, const std::string& type) { | 139 const std::string& sdp, const std::string& type) { |
| 140 blink::WebRTCSessionDescription description; | 140 blink::WebRTCSessionDescription description; |
| 141 description.initialize(base::UTF8ToUTF16(type), base::UTF8ToUTF16(sdp)); | 141 description.initialize(blink::WebString::fromUTF8(type), |
| 142 blink::WebString::fromUTF8(sdp)); |
| 142 return description; | 143 return description; |
| 143 } | 144 } |
| 144 | 145 |
| 145 blink::WebRTCSessionDescription | 146 blink::WebRTCSessionDescription |
| 146 CreateWebKitSessionDescription( | 147 CreateWebKitSessionDescription( |
| 147 const webrtc::SessionDescriptionInterface* native_desc) { | 148 const webrtc::SessionDescriptionInterface* native_desc) { |
| 148 if (!native_desc) { | 149 if (!native_desc) { |
| 149 LOG(ERROR) << "Native session description is null."; | 150 LOG(ERROR) << "Native session description is null."; |
| 150 return blink::WebRTCSessionDescription(); | 151 return blink::WebRTCSessionDescription(); |
| 151 } | 152 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // |blink_config| replace the corresponding fields in |webrtc_config|, but | 194 // |blink_config| replace the corresponding fields in |webrtc_config|, but |
| 194 // fields that only exist in |webrtc_config| are left alone. | 195 // fields that only exist in |webrtc_config| are left alone. |
| 195 void GetNativeRtcConfiguration( | 196 void GetNativeRtcConfiguration( |
| 196 const blink::WebRTCConfiguration& blink_config, | 197 const blink::WebRTCConfiguration& blink_config, |
| 197 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) { | 198 webrtc::PeerConnectionInterface::RTCConfiguration* webrtc_config) { |
| 198 DCHECK(webrtc_config); | 199 DCHECK(webrtc_config); |
| 199 | 200 |
| 200 webrtc_config->servers.clear(); | 201 webrtc_config->servers.clear(); |
| 201 for (const blink::WebRTCIceServer& blink_server : blink_config.iceServers) { | 202 for (const blink::WebRTCIceServer& blink_server : blink_config.iceServers) { |
| 202 webrtc::PeerConnectionInterface::IceServer server; | 203 webrtc::PeerConnectionInterface::IceServer server; |
| 203 server.username = | 204 server.username = blink_server.username.utf8(); |
| 204 base::UTF16ToUTF8(base::StringPiece16(blink_server.username)); | 205 server.password = blink_server.credential.utf8(); |
| 205 server.password = | |
| 206 base::UTF16ToUTF8(base::StringPiece16(blink_server.credential)); | |
| 207 server.uri = blink_server.url.string().utf8(); | 206 server.uri = blink_server.url.string().utf8(); |
| 208 webrtc_config->servers.push_back(server); | 207 webrtc_config->servers.push_back(server); |
| 209 } | 208 } |
| 210 | 209 |
| 211 switch (blink_config.iceTransportPolicy) { | 210 switch (blink_config.iceTransportPolicy) { |
| 212 case blink::WebRTCIceTransportPolicy::kNone: | 211 case blink::WebRTCIceTransportPolicy::kNone: |
| 213 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; | 212 webrtc_config->type = webrtc::PeerConnectionInterface::kNone; |
| 214 break; | 213 break; |
| 215 case blink::WebRTCIceTransportPolicy::kRelay: | 214 case blink::WebRTCIceTransportPolicy::kRelay: |
| 216 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; | 215 webrtc_config->type = webrtc::PeerConnectionInterface::kRelay; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 delete desc; | 381 delete desc; |
| 383 } | 382 } |
| 384 void OnFailure(const std::string& error) override { | 383 void OnFailure(const std::string& error) override { |
| 385 if (!main_thread_->BelongsToCurrentThread()) { | 384 if (!main_thread_->BelongsToCurrentThread()) { |
| 386 main_thread_->PostTask(FROM_HERE, | 385 main_thread_->PostTask(FROM_HERE, |
| 387 base::Bind(&CreateSessionDescriptionRequest::OnFailure, this, error)); | 386 base::Bind(&CreateSessionDescriptionRequest::OnFailure, this, error)); |
| 388 return; | 387 return; |
| 389 } | 388 } |
| 390 | 389 |
| 391 tracker_.TrackOnFailure(error); | 390 tracker_.TrackOnFailure(error); |
| 392 webkit_request_.requestFailed(base::UTF8ToUTF16(error)); | 391 webkit_request_.requestFailed(blink::WebString::fromUTF8(error)); |
| 393 webkit_request_.reset(); | 392 webkit_request_.reset(); |
| 394 } | 393 } |
| 395 | 394 |
| 396 protected: | 395 protected: |
| 397 ~CreateSessionDescriptionRequest() override { | 396 ~CreateSessionDescriptionRequest() override { |
| 398 // This object is reference counted and its callback methods |OnSuccess| and | 397 // This object is reference counted and its callback methods |OnSuccess| and |
| 399 // |OnFailure| will be invoked on libjingle's signaling thread and posted to | 398 // |OnFailure| will be invoked on libjingle's signaling thread and posted to |
| 400 // the main thread. Since the main thread may complete before the signaling | 399 // the main thread. Since the main thread may complete before the signaling |
| 401 // thread has deferenced this object there is no guarantee that this object | 400 // thread has deferenced this object there is no guarantee that this object |
| 402 // is destructed on the main thread. | 401 // is destructed on the main thread. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 webkit_request_.requestSucceeded(); | 434 webkit_request_.requestSucceeded(); |
| 436 webkit_request_.reset(); | 435 webkit_request_.reset(); |
| 437 } | 436 } |
| 438 void OnFailure(const std::string& error) override { | 437 void OnFailure(const std::string& error) override { |
| 439 if (!main_thread_->BelongsToCurrentThread()) { | 438 if (!main_thread_->BelongsToCurrentThread()) { |
| 440 main_thread_->PostTask(FROM_HERE, | 439 main_thread_->PostTask(FROM_HERE, |
| 441 base::Bind(&SetSessionDescriptionRequest::OnFailure, this, error)); | 440 base::Bind(&SetSessionDescriptionRequest::OnFailure, this, error)); |
| 442 return; | 441 return; |
| 443 } | 442 } |
| 444 tracker_.TrackOnFailure(error); | 443 tracker_.TrackOnFailure(error); |
| 445 webkit_request_.requestFailed(base::UTF8ToUTF16(error)); | 444 webkit_request_.requestFailed(blink::WebString::fromUTF8(error)); |
| 446 webkit_request_.reset(); | 445 webkit_request_.reset(); |
| 447 } | 446 } |
| 448 | 447 |
| 449 protected: | 448 protected: |
| 450 ~SetSessionDescriptionRequest() override { | 449 ~SetSessionDescriptionRequest() override { |
| 451 // This object is reference counted and its callback methods |OnSuccess| and | 450 // This object is reference counted and its callback methods |OnSuccess| and |
| 452 // |OnFailure| will be invoked on libjingle's signaling thread and posted to | 451 // |OnFailure| will be invoked on libjingle's signaling thread and posted to |
| 453 // the main thread. Since the main thread may complete before the signaling | 452 // the main thread. Since the main thread may complete before the signaling |
| 454 // thread has deferenced this object there is no guarantee that this object | 453 // thread has deferenced this object there is no guarantee that this object |
| 455 // is destructed on the main thread. | 454 // is destructed on the main thread. |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 DCHECK(native_desc); | 1235 DCHECK(native_desc); |
| 1237 return native_desc->type() == "offer" || native_desc->type() == "answer"; | 1236 return native_desc->type() == "offer" || native_desc->type() == "answer"; |
| 1238 } | 1237 } |
| 1239 | 1238 |
| 1240 void RTCPeerConnectionHandler::setLocalDescription( | 1239 void RTCPeerConnectionHandler::setLocalDescription( |
| 1241 const blink::WebRTCVoidRequest& request, | 1240 const blink::WebRTCVoidRequest& request, |
| 1242 const blink::WebRTCSessionDescription& description) { | 1241 const blink::WebRTCSessionDescription& description) { |
| 1243 DCHECK(thread_checker_.CalledOnValidThread()); | 1242 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1244 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setLocalDescription"); | 1243 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setLocalDescription"); |
| 1245 | 1244 |
| 1246 std::string sdp = base::UTF16ToUTF8(base::StringPiece16(description.sdp())); | 1245 std::string sdp = description.sdp().utf8(); |
| 1247 std::string type = | 1246 std::string type = description.type().utf8(); |
| 1248 base::UTF16ToUTF8(base::StringPiece16(description.type())); | |
| 1249 | 1247 |
| 1250 webrtc::SdpParseError error; | 1248 webrtc::SdpParseError error; |
| 1251 // Since CreateNativeSessionDescription uses the dependency factory, we need | 1249 // Since CreateNativeSessionDescription uses the dependency factory, we need |
| 1252 // to make this call on the current thread to be safe. | 1250 // to make this call on the current thread to be safe. |
| 1253 webrtc::SessionDescriptionInterface* native_desc = | 1251 webrtc::SessionDescriptionInterface* native_desc = |
| 1254 CreateNativeSessionDescription(sdp, type, &error); | 1252 CreateNativeSessionDescription(sdp, type, &error); |
| 1255 if (!native_desc) { | 1253 if (!native_desc) { |
| 1256 std::string reason_str = "Failed to parse SessionDescription. "; | 1254 std::string reason_str = "Failed to parse SessionDescription. "; |
| 1257 reason_str.append(error.line); | 1255 reason_str.append(error.line); |
| 1258 reason_str.append(" "); | 1256 reason_str.append(" "); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 native_peer_connection_, base::RetainedRef(set_request), | 1288 native_peer_connection_, base::RetainedRef(set_request), |
| 1291 base::Unretained(native_desc)), | 1289 base::Unretained(native_desc)), |
| 1292 "SetLocalDescription")); | 1290 "SetLocalDescription")); |
| 1293 } | 1291 } |
| 1294 | 1292 |
| 1295 void RTCPeerConnectionHandler::setRemoteDescription( | 1293 void RTCPeerConnectionHandler::setRemoteDescription( |
| 1296 const blink::WebRTCVoidRequest& request, | 1294 const blink::WebRTCVoidRequest& request, |
| 1297 const blink::WebRTCSessionDescription& description) { | 1295 const blink::WebRTCSessionDescription& description) { |
| 1298 DCHECK(thread_checker_.CalledOnValidThread()); | 1296 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1299 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setRemoteDescription"); | 1297 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setRemoteDescription"); |
| 1300 std::string sdp = base::UTF16ToUTF8(base::StringPiece16(description.sdp())); | 1298 std::string sdp = description.sdp().utf8(); |
| 1301 std::string type = | 1299 std::string type = description.type().utf8(); |
| 1302 base::UTF16ToUTF8(base::StringPiece16(description.type())); | |
| 1303 | 1300 |
| 1304 webrtc::SdpParseError error; | 1301 webrtc::SdpParseError error; |
| 1305 // Since CreateNativeSessionDescription uses the dependency factory, we need | 1302 // Since CreateNativeSessionDescription uses the dependency factory, we need |
| 1306 // to make this call on the current thread to be safe. | 1303 // to make this call on the current thread to be safe. |
| 1307 webrtc::SessionDescriptionInterface* native_desc = | 1304 webrtc::SessionDescriptionInterface* native_desc = |
| 1308 CreateNativeSessionDescription(sdp, type, &error); | 1305 CreateNativeSessionDescription(sdp, type, &error); |
| 1309 if (!native_desc) { | 1306 if (!native_desc) { |
| 1310 std::string reason_str = "Failed to parse SessionDescription. "; | 1307 std::string reason_str = "Failed to parse SessionDescription. "; |
| 1311 reason_str.append(error.line); | 1308 reason_str.append(error.line); |
| 1312 reason_str.append(" "); | 1309 reason_str.append(" "); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 weak_factory_.GetWeakPtr(), request, result)); | 1417 weak_factory_.GetWeakPtr(), request, result)); |
| 1421 // On failure callback will be triggered. | 1418 // On failure callback will be triggered. |
| 1422 return true; | 1419 return true; |
| 1423 } | 1420 } |
| 1424 | 1421 |
| 1425 bool RTCPeerConnectionHandler::addICECandidate( | 1422 bool RTCPeerConnectionHandler::addICECandidate( |
| 1426 const blink::WebRTCICECandidate& candidate) { | 1423 const blink::WebRTCICECandidate& candidate) { |
| 1427 DCHECK(thread_checker_.CalledOnValidThread()); | 1424 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1428 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate"); | 1425 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate"); |
| 1429 std::unique_ptr<webrtc::IceCandidateInterface> native_candidate( | 1426 std::unique_ptr<webrtc::IceCandidateInterface> native_candidate( |
| 1430 dependency_factory_->CreateIceCandidate( | 1427 dependency_factory_->CreateIceCandidate(candidate.sdpMid().utf8(), |
| 1431 base::UTF16ToUTF8(base::StringPiece16(candidate.sdpMid())), | 1428 candidate.sdpMLineIndex(), |
| 1432 candidate.sdpMLineIndex(), | 1429 candidate.candidate().utf8())); |
| 1433 base::UTF16ToUTF8(base::StringPiece16(candidate.candidate())))); | |
| 1434 bool return_value = false; | 1430 bool return_value = false; |
| 1435 | 1431 |
| 1436 if (native_candidate) { | 1432 if (native_candidate) { |
| 1437 return_value = | 1433 return_value = |
| 1438 native_peer_connection_->AddIceCandidate(native_candidate.get()); | 1434 native_peer_connection_->AddIceCandidate(native_candidate.get()); |
| 1439 LOG_IF(ERROR, !return_value) << "Error processing ICE candidate."; | 1435 LOG_IF(ERROR, !return_value) << "Error processing ICE candidate."; |
| 1440 } else { | 1436 } else { |
| 1441 LOG(ERROR) << "Could not create native ICE candidate."; | 1437 LOG(ERROR) << "Could not create native ICE candidate."; |
| 1442 } | 1438 } |
| 1443 | 1439 |
| 1444 if (peer_connection_tracker_) { | 1440 if (peer_connection_tracker_) { |
| 1445 peer_connection_tracker_->TrackAddIceCandidate( | 1441 peer_connection_tracker_->TrackAddIceCandidate( |
| 1446 this, candidate, PeerConnectionTracker::SOURCE_REMOTE, return_value); | 1442 this, candidate, PeerConnectionTracker::SOURCE_REMOTE, return_value); |
| 1447 } | 1443 } |
| 1448 return return_value; | 1444 return return_value; |
| 1449 } | 1445 } |
| 1450 | 1446 |
| 1451 void RTCPeerConnectionHandler::OnaddICECandidateResult( | 1447 void RTCPeerConnectionHandler::OnaddICECandidateResult( |
| 1452 const blink::WebRTCVoidRequest& webkit_request, bool result) { | 1448 const blink::WebRTCVoidRequest& webkit_request, bool result) { |
| 1453 DCHECK(thread_checker_.CalledOnValidThread()); | 1449 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1454 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnaddICECandidateResult"); | 1450 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnaddICECandidateResult"); |
| 1455 if (!result) { | 1451 if (!result) { |
| 1456 // We don't have the actual error code from the libjingle, so for now | 1452 // We don't have the actual error code from the libjingle, so for now |
| 1457 // using a generic error string. | 1453 // using a generic error string. |
| 1458 return webkit_request.requestFailed( | 1454 return webkit_request.requestFailed( |
| 1459 base::UTF8ToUTF16("Error processing ICE candidate")); | 1455 blink::WebString::fromUTF8("Error processing ICE candidate")); |
| 1460 } | 1456 } |
| 1461 | 1457 |
| 1462 return webkit_request.requestSucceeded(); | 1458 return webkit_request.requestSucceeded(); |
| 1463 } | 1459 } |
| 1464 | 1460 |
| 1465 bool RTCPeerConnectionHandler::addStream( | 1461 bool RTCPeerConnectionHandler::addStream( |
| 1466 const blink::WebMediaStream& stream, | 1462 const blink::WebMediaStream& stream, |
| 1467 const blink::WebMediaConstraints& options) { | 1463 const blink::WebMediaConstraints& options) { |
| 1468 DCHECK(thread_checker_.CalledOnValidThread()); | 1464 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1469 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addStream"); | 1465 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addStream"); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 | 1597 |
| 1602 void RTCPeerConnectionHandler::StopEventLog() { | 1598 void RTCPeerConnectionHandler::StopEventLog() { |
| 1603 DCHECK(thread_checker_.CalledOnValidThread()); | 1599 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1604 native_peer_connection_->StopRtcEventLog(); | 1600 native_peer_connection_->StopRtcEventLog(); |
| 1605 } | 1601 } |
| 1606 | 1602 |
| 1607 blink::WebRTCDataChannelHandler* RTCPeerConnectionHandler::createDataChannel( | 1603 blink::WebRTCDataChannelHandler* RTCPeerConnectionHandler::createDataChannel( |
| 1608 const blink::WebString& label, const blink::WebRTCDataChannelInit& init) { | 1604 const blink::WebString& label, const blink::WebRTCDataChannelInit& init) { |
| 1609 DCHECK(thread_checker_.CalledOnValidThread()); | 1605 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1610 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::createDataChannel"); | 1606 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::createDataChannel"); |
| 1611 DVLOG(1) << "createDataChannel label " | 1607 DVLOG(1) << "createDataChannel label " << label.utf8(); |
| 1612 << base::UTF16ToUTF8(base::StringPiece16(label)); | |
| 1613 | 1608 |
| 1614 webrtc::DataChannelInit config; | 1609 webrtc::DataChannelInit config; |
| 1615 // TODO(jiayl): remove the deprecated reliable field once Libjingle is updated | 1610 // TODO(jiayl): remove the deprecated reliable field once Libjingle is updated |
| 1616 // to handle that. | 1611 // to handle that. |
| 1617 config.reliable = false; | 1612 config.reliable = false; |
| 1618 config.id = init.id; | 1613 config.id = init.id; |
| 1619 config.ordered = init.ordered; | 1614 config.ordered = init.ordered; |
| 1620 config.negotiated = init.negotiated; | 1615 config.negotiated = init.negotiated; |
| 1621 config.maxRetransmits = init.maxRetransmits; | 1616 config.maxRetransmits = init.maxRetransmits; |
| 1622 config.maxRetransmitTime = init.maxRetransmitTime; | 1617 config.maxRetransmitTime = init.maxRetransmitTime; |
| 1623 config.protocol = base::UTF16ToUTF8(base::StringPiece16(init.protocol)); | 1618 config.protocol = init.protocol.utf8(); |
| 1624 | 1619 |
| 1625 rtc::scoped_refptr<webrtc::DataChannelInterface> webrtc_channel( | 1620 rtc::scoped_refptr<webrtc::DataChannelInterface> webrtc_channel( |
| 1626 native_peer_connection_->CreateDataChannel( | 1621 native_peer_connection_->CreateDataChannel(label.utf8(), &config)); |
| 1627 base::UTF16ToUTF8(base::StringPiece16(label)), &config)); | |
| 1628 if (!webrtc_channel) { | 1622 if (!webrtc_channel) { |
| 1629 DLOG(ERROR) << "Could not create native data channel."; | 1623 DLOG(ERROR) << "Could not create native data channel."; |
| 1630 return NULL; | 1624 return NULL; |
| 1631 } | 1625 } |
| 1632 if (peer_connection_tracker_) { | 1626 if (peer_connection_tracker_) { |
| 1633 peer_connection_tracker_->TrackCreateDataChannel( | 1627 peer_connection_tracker_->TrackCreateDataChannel( |
| 1634 this, webrtc_channel.get(), PeerConnectionTracker::SOURCE_LOCAL); | 1628 this, webrtc_channel.get(), PeerConnectionTracker::SOURCE_LOCAL); |
| 1635 } | 1629 } |
| 1636 | 1630 |
| 1637 ++num_data_channels_created_; | 1631 ++num_data_channels_created_; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 if (!is_closed_) | 1840 if (!is_closed_) |
| 1847 client_->didAddRemoteDataChannel(handler.release()); | 1841 client_->didAddRemoteDataChannel(handler.release()); |
| 1848 } | 1842 } |
| 1849 | 1843 |
| 1850 void RTCPeerConnectionHandler::OnIceCandidate( | 1844 void RTCPeerConnectionHandler::OnIceCandidate( |
| 1851 const std::string& sdp, const std::string& sdp_mid, int sdp_mline_index, | 1845 const std::string& sdp, const std::string& sdp_mid, int sdp_mline_index, |
| 1852 int component, int address_family) { | 1846 int component, int address_family) { |
| 1853 DCHECK(thread_checker_.CalledOnValidThread()); | 1847 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1854 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceCandidateImpl"); | 1848 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceCandidateImpl"); |
| 1855 blink::WebRTCICECandidate web_candidate; | 1849 blink::WebRTCICECandidate web_candidate; |
| 1856 web_candidate.initialize(base::UTF8ToUTF16(sdp), | 1850 web_candidate.initialize(blink::WebString::fromUTF8(sdp), |
| 1857 base::UTF8ToUTF16(sdp_mid), | 1851 blink::WebString::fromUTF8(sdp_mid), |
| 1858 sdp_mline_index); | 1852 sdp_mline_index); |
| 1859 if (peer_connection_tracker_) { | 1853 if (peer_connection_tracker_) { |
| 1860 peer_connection_tracker_->TrackAddIceCandidate( | 1854 peer_connection_tracker_->TrackAddIceCandidate( |
| 1861 this, web_candidate, PeerConnectionTracker::SOURCE_LOCAL, true); | 1855 this, web_candidate, PeerConnectionTracker::SOURCE_LOCAL, true); |
| 1862 } | 1856 } |
| 1863 | 1857 |
| 1864 // Only the first m line's first component is tracked to avoid | 1858 // Only the first m line's first component is tracked to avoid |
| 1865 // miscounting when doing BUNDLE or rtcp mux. | 1859 // miscounting when doing BUNDLE or rtcp mux. |
| 1866 if (sdp_mline_index == 0 && component == 1) { | 1860 if (sdp_mline_index == 0 && component == 1) { |
| 1867 if (address_family == AF_INET) { | 1861 if (address_family == AF_INET) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 } | 1951 } |
| 1958 | 1952 |
| 1959 void RTCPeerConnectionHandler::ResetUMAStats() { | 1953 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1960 DCHECK(thread_checker_.CalledOnValidThread()); | 1954 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1961 num_local_candidates_ipv6_ = 0; | 1955 num_local_candidates_ipv6_ = 0; |
| 1962 num_local_candidates_ipv4_ = 0; | 1956 num_local_candidates_ipv4_ = 0; |
| 1963 ice_connection_checking_start_ = base::TimeTicks(); | 1957 ice_connection_checking_start_ = base::TimeTicks(); |
| 1964 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1958 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1965 } | 1959 } |
| 1966 } // namespace content | 1960 } // namespace content |
| OLD | NEW |