diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc index 0681acbb4a..428530fac0 100644 --- a/pc/peerconnection.cc +++ b/pc/peerconnection.cc @@ -1835,6 +1835,8 @@ void PeerConnection::SetLocalDescription( network_thread()->Invoke( RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, port_allocator_.get())); + // Make UMA notes about what was agreed to. + ReportNegotiatedSdpSemantics(*local_description()); } } @@ -2074,33 +2076,7 @@ void PeerConnection::SetRemoteDescription( RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, port_allocator_.get())); // Make UMA notes about what was agreed to. - if (uma_observer_) { - switch (remote_description()->description()->msid_signaling()) { - case 0: - uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, - kSdpSemanticNegotiatedNone, - kSdpSemanticNegotiatedMax); - break; - case cricket::kMsidSignalingMediaSection: - uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, - kSdpSemanticNegotiatedUnifiedPlan, - kSdpSemanticNegotiatedMax); - break; - case cricket::kMsidSignalingSsrcAttribute: - uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, - kSdpSemanticNegotiatedPlanB, - kSdpSemanticNegotiatedMax); - break; - case cricket::kMsidSignalingMediaSection | - cricket::kMsidSignalingSsrcAttribute: - uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, - kSdpSemanticNegotiatedMixed, - kSdpSemanticNegotiatedMax); - break; - default: - RTC_NOTREACHED(); - } - } + ReportNegotiatedSdpSemantics(*remote_description()); } observer->OnSetRemoteDescriptionComplete(RTCError::OK()); @@ -5746,6 +5722,38 @@ std::string PeerConnection::GetSessionErrorMsg() { return desc.str(); } +void PeerConnection::ReportNegotiatedSdpSemantics( + const SessionDescriptionInterface& answer) { + if (!uma_observer_) { + return; + } + switch (answer.description()->msid_signaling()) { + case 0: + uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, + kSdpSemanticNegotiatedNone, + kSdpSemanticNegotiatedMax); + break; + case cricket::kMsidSignalingMediaSection: + uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, + kSdpSemanticNegotiatedUnifiedPlan, + kSdpSemanticNegotiatedMax); + break; + case cricket::kMsidSignalingSsrcAttribute: + uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, + kSdpSemanticNegotiatedPlanB, + kSdpSemanticNegotiatedMax); + break; + case cricket::kMsidSignalingMediaSection | + cricket::kMsidSignalingSsrcAttribute: + uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticNegotiated, + kSdpSemanticNegotiatedMixed, + kSdpSemanticNegotiatedMax); + break; + default: + RTC_NOTREACHED(); + } +} + // We need to check the local/remote description for the Transport instead of // the session, because a new Transport added during renegotiation may have // them unset while the session has them set from the previous negotiation. diff --git a/pc/peerconnection.h b/pc/peerconnection.h index 2f86939081..fb9a62ffcc 100644 --- a/pc/peerconnection.h +++ b/pc/peerconnection.h @@ -851,6 +851,10 @@ class PeerConnection : public PeerConnectionInternal, const char* SessionErrorToString(SessionError error) const; std::string GetSessionErrorMsg(); + // Report inferred negotiated SDP semantics from a local/remote answer to the + // UMA observer. + void ReportNegotiatedSdpSemantics(const SessionDescriptionInterface& answer); + // Invoked when TransportController connection completion is signaled. // Reports stats for all transports in use. void ReportTransportStats();