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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 | 1238 |
1239 void RTCPeerConnectionHandler::setLocalDescription( | 1239 void RTCPeerConnectionHandler::setLocalDescription( |
1240 const blink::WebRTCVoidRequest& request, | 1240 const blink::WebRTCVoidRequest& request, |
1241 const blink::WebRTCSessionDescription& description) { | 1241 const blink::WebRTCSessionDescription& description) { |
1242 DCHECK(thread_checker_.CalledOnValidThread()); | 1242 DCHECK(thread_checker_.CalledOnValidThread()); |
1243 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setLocalDescription"); | 1243 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setLocalDescription"); |
1244 | 1244 |
1245 std::string sdp = description.sdp().utf8(); | 1245 std::string sdp = description.sdp().utf8(); |
1246 std::string type = description.type().utf8(); | 1246 std::string type = description.type().utf8(); |
1247 | 1247 |
| 1248 if (peer_connection_tracker_) { |
| 1249 peer_connection_tracker_->TrackSetSessionDescription( |
| 1250 this, sdp, type, PeerConnectionTracker::SOURCE_LOCAL); |
| 1251 } |
| 1252 |
1248 webrtc::SdpParseError error; | 1253 webrtc::SdpParseError error; |
1249 // Since CreateNativeSessionDescription uses the dependency factory, we need | 1254 // Since CreateNativeSessionDescription uses the dependency factory, we need |
1250 // to make this call on the current thread to be safe. | 1255 // to make this call on the current thread to be safe. |
1251 webrtc::SessionDescriptionInterface* native_desc = | 1256 webrtc::SessionDescriptionInterface* native_desc = |
1252 CreateNativeSessionDescription(sdp, type, &error); | 1257 CreateNativeSessionDescription(sdp, type, &error); |
1253 if (!native_desc) { | 1258 if (!native_desc) { |
1254 std::string reason_str = "Failed to parse SessionDescription. "; | 1259 std::string reason_str = "Failed to parse SessionDescription. "; |
1255 reason_str.append(error.line); | 1260 reason_str.append(error.line); |
1256 reason_str.append(" "); | 1261 reason_str.append(" "); |
1257 reason_str.append(error.description); | 1262 reason_str.append(error.description); |
1258 LOG(ERROR) << reason_str; | 1263 LOG(ERROR) << reason_str; |
1259 request.requestFailed(blink::WebString::fromUTF8(reason_str)); | 1264 request.requestFailed(blink::WebString::fromUTF8(reason_str)); |
| 1265 if (peer_connection_tracker_) { |
| 1266 peer_connection_tracker_->TrackSessionDescriptionCallback( |
| 1267 this, PeerConnectionTracker::ACTION_SET_LOCAL_DESCRIPTION, |
| 1268 "OnFailure", reason_str); |
| 1269 } |
1260 return; | 1270 return; |
1261 } | 1271 } |
1262 | 1272 |
1263 if (peer_connection_tracker_) { | |
1264 peer_connection_tracker_->TrackSetSessionDescription( | |
1265 this, sdp, type, PeerConnectionTracker::SOURCE_LOCAL); | |
1266 } | |
1267 | |
1268 if (!first_local_description_ && IsOfferOrAnswer(native_desc)) { | 1273 if (!first_local_description_ && IsOfferOrAnswer(native_desc)) { |
1269 first_local_description_.reset(new FirstSessionDescription(native_desc)); | 1274 first_local_description_.reset(new FirstSessionDescription(native_desc)); |
1270 if (first_remote_description_) { | 1275 if (first_remote_description_) { |
1271 ReportFirstSessionDescriptions( | 1276 ReportFirstSessionDescriptions( |
1272 *first_local_description_, | 1277 *first_local_description_, |
1273 *first_remote_description_); | 1278 *first_remote_description_); |
1274 } | 1279 } |
1275 } | 1280 } |
1276 | 1281 |
1277 scoped_refptr<SetSessionDescriptionRequest> set_request( | 1282 scoped_refptr<SetSessionDescriptionRequest> set_request( |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 } | 1955 } |
1951 | 1956 |
1952 void RTCPeerConnectionHandler::ResetUMAStats() { | 1957 void RTCPeerConnectionHandler::ResetUMAStats() { |
1953 DCHECK(thread_checker_.CalledOnValidThread()); | 1958 DCHECK(thread_checker_.CalledOnValidThread()); |
1954 num_local_candidates_ipv6_ = 0; | 1959 num_local_candidates_ipv6_ = 0; |
1955 num_local_candidates_ipv4_ = 0; | 1960 num_local_candidates_ipv4_ = 0; |
1956 ice_connection_checking_start_ = base::TimeTicks(); | 1961 ice_connection_checking_start_ = base::TimeTicks(); |
1957 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1962 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
1958 } | 1963 } |
1959 } // namespace content | 1964 } // namespace content |
OLD | NEW |