Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 600163004: Add two UMA counters for IPv4 and IPv6 local candidates gathered in WebRTC PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reset for ice restarts and also only counts first component of first m line. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/rtc_peer_connection_handler.cc
diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc
index c5c68e4d7418ba6b9d591e72cfbb5fd56e2e8657..2c4d9aecad401163fc062f06849410c7499cebcf 100644
--- a/content/renderer/media/rtc_peer_connection_handler.cc
+++ b/content/renderer/media/rtc_peer_connection_handler.cc
@@ -390,7 +390,9 @@ RTCPeerConnectionHandler::RTCPeerConnectionHandler(
dependency_factory_(dependency_factory),
frame_(NULL),
peer_connection_tracker_(NULL),
- num_data_channels_created_(0) {
+ num_data_channels_created_(0),
+ num_local_candidates_ipv4_(0),
+ num_local_candidates_ipv6_(0) {
g_peer_connection_handlers.Get().insert(this);
}
@@ -894,6 +896,19 @@ void RTCPeerConnectionHandler::OnIceGatheringChange(
// to signal end of candidates.
blink::WebRTCICECandidate null_candidate;
client_->didGenerateICECandidate(null_candidate);
+
+ UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv4LocalCandidates",
+ num_local_candidates_ipv4_);
+
+ UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6LocalCandidates",
+ num_local_candidates_ipv6_);
+ } else if (ice_gathering_current_state_ ==
juberti2 2014/09/26 01:45:37 wouldn't it be simpler to do this if new_state ==
+ webrtc::PeerConnectionInterface::kIceGatheringComplete &&
+ new_state != ice_gathering_current_state_) {
+ // ICE restarts will change gathering state back to "gathering",
+ // reset the counter.
+ num_local_candidates_ipv6_ = 0;
+ num_local_candidates_ipv4_ = 0;
}
blink::WebRTCPeerConnectionHandlerClient::ICEGatheringState state =
@@ -901,6 +916,7 @@ void RTCPeerConnectionHandler::OnIceGatheringChange(
if (peer_connection_tracker_)
peer_connection_tracker_->TrackIceGatheringStateChange(this, state);
client_->didChangeICEGatheringState(state);
+ ice_gathering_current_state_ = new_state;
}
void RTCPeerConnectionHandler::OnAddStream(
@@ -968,6 +984,18 @@ void RTCPeerConnectionHandler::OnIceCandidate(
peer_connection_tracker_->TrackAddIceCandidate(
this, web_candidate, PeerConnectionTracker::SOURCE_LOCAL, true);
+ // Only the first m line's first component is tracked to avoid
+ // miscounting when doing BUNDLE or rtcp mux.
+ if (candidate->sdp_mline_index() == 0 &&
+ candidate->candidate().component() == 1) {
+ if (candidate->candidate().address().family() == AF_INET) {
+ num_local_candidates_ipv4_++;
+ } else if (candidate->candidate().address().family() == AF_INET6) {
+ num_local_candidates_ipv6_++;
+ } else {
+ NOTREACHED();
+ }
+ }
client_->didGenerateICECandidate(web_candidate);
}

Powered by Google App Engine
This is Rietveld 408576698