| 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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 void RTCPeerConnectionHandler::setRemoteDescription( | 1293 void RTCPeerConnectionHandler::setRemoteDescription( |
| 1294 const blink::WebRTCVoidRequest& request, | 1294 const blink::WebRTCVoidRequest& request, |
| 1295 const blink::WebRTCSessionDescription& description) { | 1295 const blink::WebRTCSessionDescription& description) { |
| 1296 DCHECK(thread_checker_.CalledOnValidThread()); | 1296 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1297 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setRemoteDescription"); | 1297 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setRemoteDescription"); |
| 1298 std::string sdp = description.sdp().utf8(); | 1298 std::string sdp = description.sdp().utf8(); |
| 1299 std::string type = description.type().utf8(); | 1299 std::string type = description.type().utf8(); |
| 1300 | 1300 |
| 1301 if (peer_connection_tracker_) { |
| 1302 peer_connection_tracker_->TrackSetSessionDescription( |
| 1303 this, sdp, type, PeerConnectionTracker::SOURCE_REMOTE); |
| 1304 } |
| 1305 |
| 1301 webrtc::SdpParseError error; | 1306 webrtc::SdpParseError error; |
| 1302 // Since CreateNativeSessionDescription uses the dependency factory, we need | 1307 // Since CreateNativeSessionDescription uses the dependency factory, we need |
| 1303 // to make this call on the current thread to be safe. | 1308 // to make this call on the current thread to be safe. |
| 1304 webrtc::SessionDescriptionInterface* native_desc = | 1309 webrtc::SessionDescriptionInterface* native_desc = |
| 1305 CreateNativeSessionDescription(sdp, type, &error); | 1310 CreateNativeSessionDescription(sdp, type, &error); |
| 1306 if (!native_desc) { | 1311 if (!native_desc) { |
| 1307 std::string reason_str = "Failed to parse SessionDescription. "; | 1312 std::string reason_str = "Failed to parse SessionDescription. "; |
| 1308 reason_str.append(error.line); | 1313 reason_str.append(error.line); |
| 1309 reason_str.append(" "); | 1314 reason_str.append(" "); |
| 1310 reason_str.append(error.description); | 1315 reason_str.append(error.description); |
| 1311 LOG(ERROR) << reason_str; | 1316 LOG(ERROR) << reason_str; |
| 1312 request.requestFailed(blink::WebString::fromUTF8(reason_str)); | 1317 request.requestFailed(blink::WebString::fromUTF8(reason_str)); |
| 1318 if (peer_connection_tracker_) { |
| 1319 peer_connection_tracker_->TrackSessionDescriptionCallback( |
| 1320 this, PeerConnectionTracker::ACTION_SET_REMOTE_DESCRIPTION, |
| 1321 "OnFailure", reason_str); |
| 1322 } |
| 1313 return; | 1323 return; |
| 1314 } | 1324 } |
| 1315 | 1325 |
| 1316 if (peer_connection_tracker_) { | |
| 1317 peer_connection_tracker_->TrackSetSessionDescription( | |
| 1318 this, sdp, type, PeerConnectionTracker::SOURCE_REMOTE); | |
| 1319 } | |
| 1320 | |
| 1321 if (!first_remote_description_ && IsOfferOrAnswer(native_desc)) { | 1326 if (!first_remote_description_ && IsOfferOrAnswer(native_desc)) { |
| 1322 first_remote_description_.reset(new FirstSessionDescription(native_desc)); | 1327 first_remote_description_.reset(new FirstSessionDescription(native_desc)); |
| 1323 if (first_local_description_) { | 1328 if (first_local_description_) { |
| 1324 ReportFirstSessionDescriptions( | 1329 ReportFirstSessionDescriptions( |
| 1325 *first_local_description_, | 1330 *first_local_description_, |
| 1326 *first_remote_description_); | 1331 *first_remote_description_); |
| 1327 } | 1332 } |
| 1328 } | 1333 } |
| 1329 | 1334 |
| 1330 scoped_refptr<SetSessionDescriptionRequest> set_request( | 1335 scoped_refptr<SetSessionDescriptionRequest> set_request( |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 } | 1950 } |
| 1946 | 1951 |
| 1947 void RTCPeerConnectionHandler::ResetUMAStats() { | 1952 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 1948 DCHECK(thread_checker_.CalledOnValidThread()); | 1953 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1949 num_local_candidates_ipv6_ = 0; | 1954 num_local_candidates_ipv6_ = 0; |
| 1950 num_local_candidates_ipv4_ = 0; | 1955 num_local_candidates_ipv4_ = 0; |
| 1951 ice_connection_checking_start_ = base::TimeTicks(); | 1956 ice_connection_checking_start_ = base::TimeTicks(); |
| 1952 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1957 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 1953 } | 1958 } |
| 1954 } // namespace content | 1959 } // namespace content |
| OLD | NEW |