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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.cc

Issue 2386783002: Add UMA metrics for ICE regathering reasons. (Closed)
Patch Set: Add const to the pooled_sessions method. Created 4 years, 2 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
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 3f68d6d6e078fd635e8f696b3b46ae12bae8ce67..6bcf0d7d2bfb09e9548501dccfde4e2ba249a5bd 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <set>
+#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/base/common.h"
#include "webrtc/base/crc32.h"
#include "webrtc/base/logging.h"
@@ -435,6 +436,11 @@ const IceConfig& P2PTransportChannel::config() const {
return config_;
}
+void P2PTransportChannel::SetMetricsObserver(
+ webrtc::MetricsObserverInterface* observer) {
+ metrics_observer_ = observer;
+}
+
void P2PTransportChannel::MaybeStartGathering() {
if (ice_parameters_.ufrag.empty() || ice_parameters_.pwd.empty()) {
LOG(LS_ERROR) << "Cannot gather candidates because ICE parameters are empty"
@@ -451,6 +457,21 @@ void P2PTransportChannel::MaybeStartGathering() {
gathering_state_ = kIceGatheringGathering;
SignalGatheringState(this);
}
+
+ if (metrics_observer_ && !allocator_sessions_.empty()) {
+ IceRestartState state;
+ if (writable()) {
+ state = IceRestartState::CONNECTED;
+ } else if (IsGettingPorts()) {
+ state = IceRestartState::CONNECTING;
+ } else {
+ state = IceRestartState::DISCONNECTED;
+ }
+ metrics_observer_->IncrementEnumCounter(
+ webrtc::kEnumCounterIceRestart, static_cast<int>(state),
+ static_cast<int>(IceRestartState::MAX_VALUE));
+ }
+
// Time for a new allocator.
std::unique_ptr<PortAllocatorSession> pooled_session =
allocator_->TakePooledSession(transport_name(), component(),
@@ -473,7 +494,6 @@ void P2PTransportChannel::MaybeStartGathering() {
AddAllocatorSession(allocator_->CreateSession(
transport_name(), component(), ice_parameters_.ufrag,
ice_parameters_.pwd));
- LOG(LS_INFO) << "Start getting ports";
allocator_sessions_.back()->StartGettingPorts();
}
}
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698