Add UMA counters for type of SDP semantic in use.

We count a) what semantics are asked for explicitly (if any),
and b) what semantics are reflected in the successfully
processed answer, as indicated by presence of msid lines
of type Unified Plan vs Plan B.

This gives an indication of usage in sessions initiated by
the browser. It does not indicate usage in sessions where the
browser is the answerer.

Bug: chromium:811683
Change-Id: I2e28a6a83df1664e1aa1e17cd4ff2921de1fba7e
Reviewed-on: https://webrtc-review.googlesource.com/52101
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22008}
This commit is contained in:
Harald Alvestrand 2018-02-13 23:48:00 +01:00 committed by Commit Bot
parent a881ac0ec9
commit 5dbb58602f
3 changed files with 83 additions and 0 deletions

View File

@ -38,6 +38,8 @@ enum PeerConnectionEnumCounterType {
kEnumCounterIceRegathering,
kEnumCounterIceRestart,
kEnumCounterKeyProtocol,
kEnumCounterSdpSemanticRequested,
kEnumCounterSdpSemanticNegotiated,
kPeerConnectionEnumCounterMax
};
@ -118,6 +120,21 @@ enum KeyExchangeProtocolType {
kEnumCounterKeyProtocolMax
};
enum SdpSemanticRequested {
kSdpSemanticRequestDefault,
kSdpSemanticRequestPlanB,
kSdpSemanticRequestUnifiedPlan,
kSdpSemanticRequestMax
};
enum SdpSemanticNegotiated {
kSdpSemanticNegotiatedNone,
kSdpSemanticNegotiatedPlanB,
kSdpSemanticNegotiatedUnifiedPlan,
kSdpSemanticNegotiatedMixed,
kSdpSemanticNegotiatedMax
};
class MetricsObserverInterface : public rtc::RefCountInterface {
public:
// |type| is the type of the enum counter to be incremented. |counter|

View File

@ -1976,6 +1976,34 @@ void PeerConnection::SetRemoteDescription(
network_thread()->Invoke<void>(
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();
}
}
}
observer->OnSetRemoteDescriptionComplete(RTCError::OK());
@ -2675,6 +2703,27 @@ void PeerConnection::RegisterUMAObserver(UMAObserver* observer) {
kEnumCounterAddressFamily, kPeerConnection_IPv4,
kPeerConnectionAddressFamilyCounter_Max);
}
// Send information about the requested SDP semantics.
switch (configuration_.sdp_semantics) {
case SdpSemantics::kDefault:
uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticRequested,
kSdpSemanticRequestDefault,
kSdpSemanticRequestMax);
break;
case SdpSemantics::kPlanB:
uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticRequested,
kSdpSemanticRequestPlanB,
kSdpSemanticRequestMax);
break;
case SdpSemantics::kUnifiedPlan:
uma_observer_->IncrementEnumCounter(kEnumCounterSdpSemanticRequested,
kSdpSemanticRequestUnifiedPlan,
kSdpSemanticRequestMax);
break;
default:
RTC_NOTREACHED();
}
}
}

View File

@ -13,6 +13,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/fakemetricsobserver.h"
#include "api/jsep.h"
#include "api/mediastreaminterface.h"
#include "api/peerconnectioninterface.h"
@ -889,6 +890,9 @@ TEST_F(PeerConnectionMsidSignalingTest, UnifiedPlanTalkingToOurself) {
caller->AddAudioTrack("caller_audio");
auto callee = CreatePeerConnectionWithUnifiedPlan();
callee->AddAudioTrack("callee_audio");
auto caller_observer =
new rtc::RefCountedObject<webrtc::FakeMetricsObserver>();
caller->pc()->RegisterUMAObserver(caller_observer);
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
@ -902,6 +906,19 @@ TEST_F(PeerConnectionMsidSignalingTest, UnifiedPlanTalkingToOurself) {
auto* answer = caller->pc()->remote_description();
EXPECT_EQ(cricket::kMsidSignalingMediaSection,
answer->description()->msid_signaling());
// Check that this is counted correctly
EXPECT_EQ(1, caller_observer->GetEnumCounter(
webrtc::kEnumCounterSdpSemanticNegotiated,
webrtc::kSdpSemanticNegotiatedUnifiedPlan));
EXPECT_EQ(0, caller_observer->GetEnumCounter(
webrtc::kEnumCounterSdpSemanticNegotiated,
webrtc::kSdpSemanticNegotiatedNone));
EXPECT_EQ(0, caller_observer->GetEnumCounter(
webrtc::kEnumCounterSdpSemanticNegotiated,
webrtc::kSdpSemanticNegotiatedPlanB));
EXPECT_EQ(0, caller_observer->GetEnumCounter(
webrtc::kEnumCounterSdpSemanticNegotiated,
webrtc::kSdpSemanticNegotiatedMixed));
}
TEST_F(PeerConnectionMsidSignalingTest, PlanBOfferToUnifiedPlanAnswer) {