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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 webrtc::PeerConnectionInterface::IceConnectionState new_state) { | 1299 webrtc::PeerConnectionInterface::IceConnectionState new_state) { |
1300 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceConnectionChange"); | 1300 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceConnectionChange"); |
1301 DCHECK(thread_checker_.CalledOnValidThread()); | 1301 DCHECK(thread_checker_.CalledOnValidThread()); |
1302 if (new_state == webrtc::PeerConnectionInterface::kIceConnectionChecking) { | 1302 if (new_state == webrtc::PeerConnectionInterface::kIceConnectionChecking) { |
1303 ice_connection_checking_start_ = base::TimeTicks::Now(); | 1303 ice_connection_checking_start_ = base::TimeTicks::Now(); |
1304 } else if (new_state == | 1304 } else if (new_state == |
1305 webrtc::PeerConnectionInterface::kIceConnectionConnected) { | 1305 webrtc::PeerConnectionInterface::kIceConnectionConnected) { |
1306 // If the state becomes connected, send the time needed for PC to become | 1306 // If the state becomes connected, send the time needed for PC to become |
1307 // connected from checking to UMA. UMA data will help to know how much | 1307 // connected from checking to UMA. UMA data will help to know how much |
1308 // time needed for PC to connect with remote peer. | 1308 // time needed for PC to connect with remote peer. |
| 1309 if (ice_connection_checking_start_.is_null()) { |
| 1310 // From UMA, we have observed a large number of calls falling into the |
| 1311 // overflow buckets. One possibility is that the Checking is not signaled |
| 1312 // before Connected. This is to guard against that situation to make the |
| 1313 // metric more robust. |
| 1314 UMA_HISTOGRAM_MEDIUM_TIMES("WebRTC.PeerConnection.TimeToConnect", |
| 1315 base::TimeDelta()); |
| 1316 } else { |
1309 UMA_HISTOGRAM_MEDIUM_TIMES( | 1317 UMA_HISTOGRAM_MEDIUM_TIMES( |
1310 "WebRTC.PeerConnection.TimeToConnect", | 1318 "WebRTC.PeerConnection.TimeToConnect", |
1311 base::TimeTicks::Now() - ice_connection_checking_start_); | 1319 base::TimeTicks::Now() - ice_connection_checking_start_); |
| 1320 } |
1312 } | 1321 } |
1313 | 1322 |
1314 track_metrics_.IceConnectionChange(new_state); | 1323 track_metrics_.IceConnectionChange(new_state); |
1315 blink::WebRTCPeerConnectionHandlerClient::ICEConnectionState state = | 1324 blink::WebRTCPeerConnectionHandlerClient::ICEConnectionState state = |
1316 GetWebKitIceConnectionState(new_state); | 1325 GetWebKitIceConnectionState(new_state); |
1317 if (peer_connection_tracker_) | 1326 if (peer_connection_tracker_) |
1318 peer_connection_tracker_->TrackIceConnectionStateChange(this, state); | 1327 peer_connection_tracker_->TrackIceConnectionStateChange(this, state); |
1319 if(client_) | 1328 if(client_) |
1320 client_->didChangeICEConnectionState(state); | 1329 client_->didChangeICEConnectionState(state); |
1321 } | 1330 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 base::WaitableEvent event(false, false); | 1502 base::WaitableEvent event(false, false); |
1494 thread->PostTask(FROM_HERE, | 1503 thread->PostTask(FROM_HERE, |
1495 base::Bind(&RunSynchronousClosure, closure, | 1504 base::Bind(&RunSynchronousClosure, closure, |
1496 base::Unretained(trace_event_name), | 1505 base::Unretained(trace_event_name), |
1497 base::Unretained(&event))); | 1506 base::Unretained(&event))); |
1498 event.Wait(); | 1507 event.Wait(); |
1499 } | 1508 } |
1500 } | 1509 } |
1501 | 1510 |
1502 } // namespace content | 1511 } // namespace content |
OLD | NEW |