Add directive to make webrtc metrics optional.

Bug: webrtc:11144
Change-Id: I4e75e6aec033784685de3670e880bb9f2b6ee8d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161043
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30040}
This commit is contained in:
Ying Wang 2019-12-09 13:06:53 +01:00 committed by Commit Bot
parent 00d0f178c2
commit ef3998ffd1
26 changed files with 1101 additions and 763 deletions

View File

@ -271,6 +271,10 @@ config("common_config") {
defines += [ "RTC_DISABLE_TRACE_EVENTS" ]
}
if (rtc_disable_metrics) {
defines += [ "RTC_DISABLE_METRICS" ]
}
cflags = []
if (build_with_chromium) {

View File

@ -319,7 +319,7 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
if (!field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
// TODO(bugs.webrtc.org/10417): Reenable this for iOS
#if !defined(WEBRTC_IOS)
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
#endif
}
}

View File

@ -47,7 +47,7 @@ class AudioMixerImpl : public AudioMixer {
// AudioProcessing only accepts 10 ms frames.
static const int kFrameDurationInMs = 10;
static const int kMaximumAmountOfMixedAudioSources = 3;
enum : int { kMaximumAmountOfMixedAudioSources = 3 };
static rtc::scoped_refptr<AudioMixerImpl> Create();

View File

@ -215,7 +215,6 @@ void FrameCombiner::LogMixingStats(const std::vector<AudioFrame*>& mix_list,
NativeRate::kSampleRate32kHz, NativeRate::kSampleRate48kHz};
const auto* rate_position = std::lower_bound(
std::begin(native_rates), std::end(native_rates), sample_rate);
RTC_HISTOGRAM_ENUMERATION(
"WebRTC.Audio.AudioMixer.MixingRate",
std::distance(std::begin(native_rates), rate_position),

View File

@ -34,7 +34,7 @@ class RmsLevel {
int peak;
};
static constexpr int kMinLevelDb = 127;
enum : int { kMinLevelDb = 127 };
RmsLevel();
~RmsLevel();

View File

@ -571,35 +571,41 @@ TEST_F(ScreenshareLayerTest, UpdatesHistograms) {
layers_.reset(); // Histograms are reported on destruction.
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.Layer0.FrameRate"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.Layer1.FrameRate"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.Screenshare.FramesPerDrop"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.FramesPerOvershoot"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.Screenshare.Layer0.Qp"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.Screenshare.Layer1.Qp"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.Layer0.FrameRate"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.Layer1.FrameRate"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.FramesPerDrop"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.FramesPerOvershoot"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.Layer0.Qp"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.Layer1.Qp"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.Layer0.TargetBitrate"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.Layer1.TargetBitrate"));
EXPECT_GT(metrics::MinSample("WebRTC.Video.Screenshare.Layer0.FrameRate"), 1);
EXPECT_GT(metrics::MinSample("WebRTC.Video.Screenshare.Layer1.FrameRate"), 1);
EXPECT_GT(metrics::MinSample("WebRTC.Video.Screenshare.FramesPerDrop"), 1);
EXPECT_GT(metrics::MinSample("WebRTC.Video.Screenshare.FramesPerOvershoot"),
1);
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.Screenshare.Layer0.Qp", kTl0Qp));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.Screenshare.Layer1.Qp", kTl1Qp));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.Screenshare.Layer0.TargetBitrate",
kDefaultTl0BitrateKbps));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.Screenshare.Layer1.TargetBitrate",
kDefaultTl1BitrateKbps));
EXPECT_METRIC_GT(
metrics::MinSample("WebRTC.Video.Screenshare.Layer0.FrameRate"), 1);
EXPECT_METRIC_GT(
metrics::MinSample("WebRTC.Video.Screenshare.Layer1.FrameRate"), 1);
EXPECT_METRIC_GT(metrics::MinSample("WebRTC.Video.Screenshare.FramesPerDrop"),
1);
EXPECT_METRIC_GT(
metrics::MinSample("WebRTC.Video.Screenshare.FramesPerOvershoot"), 1);
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.Screenshare.Layer0.Qp", kTl0Qp));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.Screenshare.Layer1.Qp", kTl1Qp));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.Screenshare.Layer0.TargetBitrate",
kDefaultTl0BitrateKbps));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.Screenshare.Layer1.TargetBitrate",
kDefaultTl1BitrateKbps));
}
TEST_F(ScreenshareLayerTest, RespectsConfiguredFramerate) {

View File

@ -1310,16 +1310,16 @@ TEST_F(P2PTransportChannelTest, TestUMAIceRestartWhileDisconnected) {
ep1_ch1()->SetIceParameters(kIceParams[2]);
ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
ep1_ch1()->MaybeStartGathering();
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::DISCONNECTED)));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::DISCONNECTED)));
ep2_ch1()->SetIceParameters(kIceParams[3]);
ep2_ch1()->SetRemoteIceParameters(kIceParams[2]);
ep2_ch1()->MaybeStartGathering();
EXPECT_EQ(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::DISCONNECTED)));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::DISCONNECTED)));
DestroyChannels();
}
@ -1337,16 +1337,16 @@ TEST_F(P2PTransportChannelTest, TestUMAIceRestartWhileConnected) {
ep1_ch1()->SetIceParameters(kIceParams[2]);
ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
ep1_ch1()->MaybeStartGathering();
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTED)));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTED)));
ep2_ch1()->SetIceParameters(kIceParams[3]);
ep2_ch1()->SetRemoteIceParameters(kIceParams[2]);
ep2_ch1()->MaybeStartGathering();
EXPECT_EQ(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTED)));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTED)));
DestroyChannels();
}
@ -1363,16 +1363,16 @@ TEST_F(P2PTransportChannelTest, TestUMAIceRestartWhileConnecting) {
ep1_ch1()->SetIceParameters(kIceParams[2]);
ep1_ch1()->SetRemoteIceParameters(kIceParams[3]);
ep1_ch1()->MaybeStartGathering();
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTING)));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTING)));
ep2_ch1()->SetIceParameters(kIceParams[3]);
ep2_ch1()->SetRemoteIceParameters(kIceParams[2]);
ep2_ch1()->MaybeStartGathering();
EXPECT_EQ(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTING)));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRestartState",
static_cast<int>(IceRestartState::CONNECTING)));
DestroyChannels();
}
@ -1436,9 +1436,10 @@ TEST_F(P2PTransportChannelTest,
SIMULATED_WAIT(false, kNetworkFailureTimeout, clock);
EXPECT_LE(1, GetEndpoint(0)->GetIceRegatheringCountForReason(
IceRegatheringReason::NETWORK_FAILURE));
EXPECT_LE(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRegatheringReason",
static_cast<int>(IceRegatheringReason::NETWORK_FAILURE)));
EXPECT_METRIC_LE(
1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRegatheringReason",
static_cast<int>(IceRegatheringReason::NETWORK_FAILURE)));
EXPECT_EQ(0, GetEndpoint(1)->GetIceRegatheringCountForReason(
IceRegatheringReason::NETWORK_FAILURE));
@ -1469,9 +1470,10 @@ TEST_F(P2PTransportChannelTest, TestIceRegatherOnAllNetworksContinual) {
// Expect regathering to happen 5 times in 11s with 2s interval.
EXPECT_LE(5, GetEndpoint(0)->GetIceRegatheringCountForReason(
IceRegatheringReason::OCCASIONAL_REFRESH));
EXPECT_LE(5, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRegatheringReason",
static_cast<int>(IceRegatheringReason::OCCASIONAL_REFRESH)));
EXPECT_METRIC_LE(
5, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRegatheringReason",
static_cast<int>(IceRegatheringReason::OCCASIONAL_REFRESH)));
// Expect no regathering if continual gathering not configured.
EXPECT_EQ(0, GetEndpoint(1)->GetIceRegatheringCountForReason(
IceRegatheringReason::OCCASIONAL_REFRESH));

View File

@ -2373,9 +2373,10 @@ TEST_F(BasicPortAllocatorTest, IceRegatheringMetricsLoggedWhenNetworkChanges) {
AddInterface(kClientAddr2, "test_net1");
EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
kDefaultAllocationTimeout, fake_clock);
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRegatheringReason",
static_cast<int>(IceRegatheringReason::NETWORK_CHANGE)));
EXPECT_METRIC_EQ(1,
webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.IceRegatheringReason",
static_cast<int>(IceRegatheringReason::NETWORK_CHANGE)));
}
// Test that when an mDNS responder is present, the local address of a host

View File

@ -398,9 +398,9 @@ TEST_F(PeerConnectionUsageHistogramTest, UsageFingerprintHistogramFromTimeout) {
auto pc = CreatePeerConnectionWithImmediateReport();
int expected_fingerprint = MakeUsageFingerprint({});
ASSERT_EQ_WAIT(1, webrtc::metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_EQ(
EXPECT_METRIC_EQ_WAIT(1, webrtc::metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_METRIC_EQ(
1, webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
}
@ -430,8 +430,8 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintAudioVideo) {
PeerConnection::UsageEvent::CLOSE_CALLED});
// In this case, we may or may not have PRIVATE_CANDIDATE_COLLECTED,
// depending on the machine configuration.
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_TRUE(
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_TRUE(
webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint) ==
2 ||
webrtc::metrics::NumEvents(
@ -484,12 +484,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithMdnsCaller) {
PeerConnection::UsageEvent::ICE_STATE_CONNECTED,
PeerConnection::UsageEvent::REMOTE_CANDIDATE_ADDED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
}
// Test getting the usage fingerprint when the callee collects an mDNS
@ -533,12 +532,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithMdnsCallee) {
PeerConnection::UsageEvent::REMOTE_CANDIDATE_ADDED,
PeerConnection::UsageEvent::DIRECT_CONNECTION_SELECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
}
#ifdef HAVE_SCTP
@ -560,8 +558,8 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintDataOnly) {
PeerConnection::UsageEvent::REMOTE_CANDIDATE_ADDED,
PeerConnection::UsageEvent::DIRECT_CONNECTION_SELECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_TRUE(
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_TRUE(
webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint) ==
2 ||
webrtc::metrics::NumEvents(
@ -590,8 +588,8 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintStunTurn) {
MakeUsageFingerprint({PeerConnection::UsageEvent::STUN_SERVER_ADDED,
PeerConnection::UsageEvent::TURN_SERVER_ADDED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(
1, webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
}
@ -612,8 +610,8 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintStunTurnInReconfiguration) {
MakeUsageFingerprint({PeerConnection::UsageEvent::STUN_SERVER_ADDED,
PeerConnection::UsageEvent::TURN_SERVER_ADDED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(
1, webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
}
@ -648,12 +646,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIPCaller) {
PeerConnection::UsageEvent::REMOTE_CANDIDATE_ADDED,
PeerConnection::UsageEvent::DIRECT_CONNECTION_SELECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
}
TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIpv6Callee) {
@ -689,12 +686,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIpv6Callee) {
PeerConnection::UsageEvent::ICE_STATE_CONNECTED,
PeerConnection::UsageEvent::DIRECT_CONNECTION_SELECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
}
#ifndef WEBRTC_ANDROID
@ -772,12 +768,11 @@ TEST_F(PeerConnectionUsageHistogramTest,
PeerConnection::UsageEvent::ICE_STATE_CONNECTED,
PeerConnection::UsageEvent::DIRECT_CONNECTION_SELECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_caller));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
expected_fingerprint_callee));
}
TEST_F(PeerConnectionUsageHistogramTest, NotableUsageNoted) {
@ -790,14 +785,15 @@ TEST_F(PeerConnectionUsageHistogramTest, NotableUsageNoted) {
PeerConnection::UsageEvent::SET_LOCAL_DESCRIPTION_SUCCEEDED,
PeerConnection::UsageEvent::CANDIDATE_COLLECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_TRUE(expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
static_cast<int>(
PeerConnection::UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) ==
ObservedFingerprint());
EXPECT_EQ(absl::make_optional(ObservedFingerprint()),
caller->observer()->interesting_usage_detected());
EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_TRUE(
expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
static_cast<int>(
PeerConnection::UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) ==
ObservedFingerprint());
EXPECT_METRIC_EQ(absl::make_optional(ObservedFingerprint()),
caller->observer()->interesting_usage_detected());
}
TEST_F(PeerConnectionUsageHistogramTest, NotableUsageOnEventFiring) {
@ -808,17 +804,18 @@ TEST_F(PeerConnectionUsageHistogramTest, NotableUsageOnEventFiring) {
{PeerConnection::UsageEvent::DATA_ADDED,
PeerConnection::UsageEvent::SET_LOCAL_DESCRIPTION_SUCCEEDED,
PeerConnection::UsageEvent::CANDIDATE_COLLECTED});
EXPECT_EQ(0, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(0, webrtc::metrics::NumSamples(kUsagePatternMetric));
caller->GetInternalPeerConnection()->RequestUsagePatternReportForTesting();
EXPECT_EQ_WAIT(1, webrtc::metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_TRUE(expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
static_cast<int>(
PeerConnection::UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) ==
ObservedFingerprint());
EXPECT_EQ(absl::make_optional(ObservedFingerprint()),
caller->observer()->interesting_usage_detected());
EXPECT_METRIC_EQ_WAIT(1, webrtc::metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_METRIC_TRUE(
expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
static_cast<int>(
PeerConnection::UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) ==
ObservedFingerprint());
EXPECT_METRIC_EQ(absl::make_optional(ObservedFingerprint()),
caller->observer()->interesting_usage_detected());
}
TEST_F(PeerConnectionUsageHistogramTest,
@ -831,20 +828,21 @@ TEST_F(PeerConnectionUsageHistogramTest,
PeerConnection::UsageEvent::SET_LOCAL_DESCRIPTION_SUCCEEDED,
PeerConnection::UsageEvent::CANDIDATE_COLLECTED,
PeerConnection::UsageEvent::CLOSE_CALLED});
EXPECT_EQ(0, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(0, webrtc::metrics::NumSamples(kUsagePatternMetric));
caller->pc()->Close();
EXPECT_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
caller->GetInternalPeerConnection()->RequestUsagePatternReportForTesting();
caller->observer()->ClearInterestingUsageDetector();
EXPECT_EQ_WAIT(2, webrtc::metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_TRUE(expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
static_cast<int>(
PeerConnection::UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) ==
ObservedFingerprint());
EXPECT_METRIC_EQ_WAIT(2, webrtc::metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_METRIC_TRUE(
expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
static_cast<int>(
PeerConnection::UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) ==
ObservedFingerprint());
// After close, the usage-detection callback should NOT have been called.
EXPECT_FALSE(caller->observer()->interesting_usage_detected());
EXPECT_METRIC_FALSE(caller->observer()->interesting_usage_detected());
}
#endif
#endif

View File

@ -457,8 +457,9 @@ TEST_P(PeerConnectionIceTest, CannotAddCandidateWhenRemoteDescriptionNotSet) {
caller->CreateOfferAndSetAsLocal();
EXPECT_FALSE(caller->pc()->AddIceCandidate(jsep_candidate.get()));
EXPECT_THAT(webrtc::metrics::Samples("WebRTC.PeerConnection.AddIceCandidate"),
ElementsAre(Pair(kAddIceCandidateFailNoRemoteDescription, 2)));
EXPECT_METRIC_THAT(
webrtc::metrics::Samples("WebRTC.PeerConnection.AddIceCandidate"),
ElementsAre(Pair(kAddIceCandidateFailNoRemoteDescription, 2)));
}
TEST_P(PeerConnectionIceTest, CannotAddCandidateWhenPeerConnectionClosed) {

View File

@ -1658,9 +1658,9 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(expected_cipher_suite),
caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout);
// TODO(bugs.webrtc.org/9456): Fix it.
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
expected_cipher_suite));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
expected_cipher_suite));
}
void TestGcmNegotiationUsesCipherSuite(bool local_gcm_enabled,
@ -1844,10 +1844,12 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithDtls) {
MediaExpectations media_expectations;
media_expectations.ExpectBidirectionalAudioAndVideo();
ASSERT_TRUE(ExpectNewFrames(media_expectations));
EXPECT_LE(2, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolDtls));
EXPECT_EQ(0, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolSdes));
EXPECT_METRIC_LE(
2, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolDtls));
EXPECT_METRIC_EQ(
0, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolSdes));
}
// Uses SDES instead of DTLS for key agreement.
@ -1866,10 +1868,12 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithSdes) {
MediaExpectations media_expectations;
media_expectations.ExpectBidirectionalAudioAndVideo();
ASSERT_TRUE(ExpectNewFrames(media_expectations));
EXPECT_LE(2, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolSdes));
EXPECT_EQ(0, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolDtls));
EXPECT_METRIC_LE(
2, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolSdes));
EXPECT_METRIC_EQ(
0, webrtc::metrics::NumEvents("WebRTC.PeerConnection.KeyProtocol",
webrtc::kEnumCounterKeyProtocolDtls));
}
// Basic end-to-end test specifying the |enable_encrypted_rtp_header_extensions|
@ -3036,9 +3040,9 @@ TEST_P(PeerConnectionIntegrationTest, Dtls10CipherStatsAndUmaMetrics) {
EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite),
caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout);
// TODO(bugs.webrtc.org/9456): Fix it.
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
kDefaultSrtpCryptoSuite));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
kDefaultSrtpCryptoSuite));
}
// Test getting cipher stats and UMA metrics when DTLS 1.2 is negotiated.
@ -3058,9 +3062,9 @@ TEST_P(PeerConnectionIntegrationTest, Dtls12CipherStatsAndUmaMetrics) {
EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite),
caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout);
// TODO(bugs.webrtc.org/9456): Fix it.
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
kDefaultSrtpCryptoSuite));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
kDefaultSrtpCryptoSuite));
}
// Test that DTLS 1.0 can be used if the caller supports DTLS 1.2 and the
@ -4359,9 +4363,9 @@ TEST_P(PeerConnectionIntegrationTest,
EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kDefaultTimeout);
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.CandidatePairType_UDP",
webrtc::kIceCandidatePairHostNameHostName));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.CandidatePairType_UDP",
webrtc::kIceCandidatePairHostNameHostName));
}
// Test that firewalling the ICE connection causes the clients to identify the
@ -4593,19 +4597,19 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyBestConnection) {
if (TestIPv6()) {
// When IPv6 is enabled, we should prefer an IPv6 connection over an IPv4
// connection.
EXPECT_EQ(0, num_best_ipv4);
EXPECT_EQ(1, num_best_ipv6);
EXPECT_METRIC_EQ(0, num_best_ipv4);
EXPECT_METRIC_EQ(1, num_best_ipv6);
} else {
EXPECT_EQ(1, num_best_ipv4);
EXPECT_EQ(0, num_best_ipv6);
EXPECT_METRIC_EQ(1, num_best_ipv4);
EXPECT_METRIC_EQ(0, num_best_ipv6);
}
EXPECT_EQ(0, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.CandidatePairType_UDP",
webrtc::kIceCandidatePairHostHost));
EXPECT_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.CandidatePairType_UDP",
webrtc::kIceCandidatePairHostPublicHostPublic));
EXPECT_METRIC_EQ(0, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.CandidatePairType_UDP",
webrtc::kIceCandidatePairHostHost));
EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.CandidatePairType_UDP",
webrtc::kIceCandidatePairHostPublicHostPublic));
}
constexpr uint32_t kFlagsIPv4NoStun = cricket::PORTALLOCATOR_DISABLE_TCP |

View File

@ -1571,8 +1571,9 @@ TEST_F(PeerConnectionMsidSignalingTest, UnifiedPlanTalkingToOurself) {
EXPECT_EQ(cricket::kMsidSignalingMediaSection,
answer->description()->msid_signaling());
// Check that this is counted correctly
EXPECT_THAT(metrics::Samples("WebRTC.PeerConnection.SdpSemanticNegotiated"),
ElementsAre(Pair(kSdpSemanticNegotiatedUnifiedPlan, 2)));
EXPECT_METRIC_THAT(
metrics::Samples("WebRTC.PeerConnection.SdpSemanticNegotiated"),
ElementsAre(Pair(kSdpSemanticNegotiatedUnifiedPlan, 2)));
}
TEST_F(PeerConnectionMsidSignalingTest, PlanBOfferToUnifiedPlanAnswer) {
@ -1660,8 +1661,9 @@ TEST_F(SdpFormatReceivedTest, DataChannelOnlyIsReportedAsNoTracks) {
ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOffer()));
// Note that only the callee does ReportSdpFormatReceived.
EXPECT_THAT(metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedNoTracks, 1)));
EXPECT_METRIC_THAT(
metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedNoTracks, 1)));
}
#endif // HAVE_SCTP
@ -1673,8 +1675,9 @@ TEST_F(SdpFormatReceivedTest, SimpleUnifiedPlanIsReportedAsSimple) {
ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOffer()));
// Note that only the callee does ReportSdpFormatReceived.
EXPECT_THAT(metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedSimple, 1)));
EXPECT_METRIC_THAT(
metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedSimple, 1)));
}
TEST_F(SdpFormatReceivedTest, SimplePlanBIsReportedAsSimple) {
@ -1684,8 +1687,9 @@ TEST_F(SdpFormatReceivedTest, SimplePlanBIsReportedAsSimple) {
ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOffer()));
// Note that only the callee does ReportSdpFormatReceived.
EXPECT_THAT(metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedSimple, 1)));
EXPECT_METRIC_THAT(
metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedSimple, 1)));
}
TEST_F(SdpFormatReceivedTest, ComplexUnifiedIsReportedAsComplexUnifiedPlan) {
@ -1697,8 +1701,9 @@ TEST_F(SdpFormatReceivedTest, ComplexUnifiedIsReportedAsComplexUnifiedPlan) {
ASSERT_TRUE(callee->SetRemoteDescription(caller->CreateOffer()));
// Note that only the callee does ReportSdpFormatReceived.
EXPECT_THAT(metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedComplexUnifiedPlan, 1)));
EXPECT_METRIC_THAT(
metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedComplexUnifiedPlan, 1)));
}
TEST_F(SdpFormatReceivedTest, ComplexPlanBIsReportedAsComplexPlanB) {
@ -1712,8 +1717,9 @@ TEST_F(SdpFormatReceivedTest, ComplexPlanBIsReportedAsComplexPlanB) {
// SDP Format to be recorded.
ASSERT_FALSE(callee->SetRemoteDescription(caller->CreateOffer()));
// Note that only the callee does ReportSdpFormatReceived.
EXPECT_THAT(metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedComplexPlanB, 1)));
EXPECT_METRIC_THAT(
metrics::Samples("WebRTC.PeerConnection.SdpFormatReceived"),
ElementsAre(Pair(kSdpFormatReceivedComplexPlanB, 1)));
}
// Sender setups in a call.

View File

@ -77,6 +77,7 @@ std::vector<SimulcastLayer> CreateLayers(const std::vector<std::string>& rids,
return CreateLayers(rids, std::vector<bool>(rids.size(), active));
}
#if RTC_METRICS_ENABLED
std::vector<SimulcastLayer> CreateLayers(int num_layers, bool active) {
rtc::UniqueStringGenerator rid_generator;
std::vector<std::string> rids;
@ -85,8 +86,10 @@ std::vector<SimulcastLayer> CreateLayers(int num_layers, bool active) {
}
return CreateLayers(rids, active);
}
#endif
} // namespace
namespace webrtc {
class PeerConnectionSimulcastTests : public ::testing::Test {
@ -193,6 +196,7 @@ class PeerConnectionSimulcastTests : public ::testing::Test {
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
};
#if RTC_METRICS_ENABLED
// This class is used to test the metrics emitted for simulcast.
class PeerConnectionSimulcastMetricsTests
: public PeerConnectionSimulcastTests,
@ -209,6 +213,7 @@ class PeerConnectionSimulcastMetricsTests
"WebRTC.PeerConnection.Simulcast.ApplyRemoteDescription");
}
};
#endif
// Validates that RIDs are supported arguments when adding a transceiver.
TEST_F(PeerConnectionSimulcastTests, CanCreateTransceiverWithRid) {
@ -550,6 +555,8 @@ TEST_F(PeerConnectionSimulcastTests, NegotiationDoesNotHaveRidExtension) {
EXPECT_TRUE(local->SetRemoteDescription(std::move(answer), &err)) << err;
ValidateTransceiverParameters(transceiver, expected_layers);
}
#if RTC_METRICS_ENABLED
//
// Checks the logged metrics when simulcast is not used.
TEST_F(PeerConnectionSimulcastMetricsTests, NoSimulcastUsageIsLogged) {
@ -719,5 +726,5 @@ TEST_P(PeerConnectionSimulcastMetricsTests, NumberOfSendEncodingsIsLogged) {
INSTANTIATE_TEST_SUITE_P(NumberOfSendEncodings,
PeerConnectionSimulcastMetricsTests,
::testing::Range(0, kMaxLayersInMetricsTest));
#endif
} // namespace webrtc

View File

@ -153,11 +153,11 @@ TEST_F(SrtpSessionTest, TestTamperReject) {
rtp_packet_[0] = 0x12;
rtcp_packet_[1] = 0x34;
EXPECT_FALSE(s2_.UnprotectRtp(rtp_packet_, rtp_len_, &out_len));
EXPECT_THAT(
EXPECT_METRIC_THAT(
webrtc::metrics::Samples("WebRTC.PeerConnection.SrtpUnprotectError"),
ElementsAre(Pair(srtp_err_status_bad_param, 1)));
EXPECT_FALSE(s2_.UnprotectRtcp(rtcp_packet_, rtcp_len_, &out_len));
EXPECT_THAT(
EXPECT_METRIC_THAT(
webrtc::metrics::Samples("WebRTC.PeerConnection.SrtcpUnprotectError"),
ElementsAre(Pair(srtp_err_status_auth_fail, 1)));
}
@ -170,11 +170,11 @@ TEST_F(SrtpSessionTest, TestUnencryptReject) {
EXPECT_TRUE(s2_.SetRecv(SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen,
kEncryptedHeaderExtensionIds));
EXPECT_FALSE(s2_.UnprotectRtp(rtp_packet_, rtp_len_, &out_len));
EXPECT_THAT(
EXPECT_METRIC_THAT(
webrtc::metrics::Samples("WebRTC.PeerConnection.SrtpUnprotectError"),
ElementsAre(Pair(srtp_err_status_auth_fail, 1)));
EXPECT_FALSE(s2_.UnprotectRtcp(rtcp_packet_, rtcp_len_, &out_len));
EXPECT_THAT(
EXPECT_METRIC_THAT(
webrtc::metrics::Samples("WebRTC.PeerConnection.SrtcpUnprotectError"),
ElementsAre(Pair(srtp_err_status_cant_check, 1)));
}

View File

@ -44,7 +44,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.Logging;
import org.webrtc.Metrics.HistogramInfo;
import org.webrtc.PeerConnection.IceConnectionState;
import org.webrtc.PeerConnection.IceGatheringState;
import org.webrtc.PeerConnection.PeerConnectionState;
@ -1157,7 +1156,6 @@ public class PeerConnectionTest {
offeringPC = null;
shutdownPC(answeringPC, answeringExpectations);
answeringPC = null;
getMetrics();
videoCapturer.stopCapture();
videoCapturer.dispose();
videoSource.dispose();
@ -1872,16 +1870,6 @@ public class PeerConnectionTest {
assertNull(sdpLatch.getSdp());
}
private static void getMetrics() {
Metrics metrics = Metrics.getAndReset();
assertTrue(metrics.map.size() > 0);
// Test for example that the lifetime of a Call is recorded.
String name = "WebRTC.Call.LifetimeInSeconds";
assertTrue(metrics.map.containsKey(name));
HistogramInfo info = metrics.map.get(name);
assertTrue(info.samples.size() > 0);
}
@SuppressWarnings("deprecation") // TODO(sakal): getStats is deprecated
private static void shutdownPC(PeerConnection pc, ObserverExpectations expectations) {
if (expectations.dataChannel != null) {

View File

@ -20,6 +20,39 @@
#include "rtc_base/atomic_ops.h"
#include "rtc_base/checks.h"
#if defined(RTC_DISABLE_METRICS)
#define RTC_METRICS_ENABLED 0
#else
#define RTC_METRICS_ENABLED 1
#endif
namespace webrtc {
namespace metrics_impl {
template <typename... Ts>
void NoOp(const Ts&...) {}
}
}
#if RTC_METRICS_ENABLED
#define EXPECT_METRIC_EQ(val1, val2) EXPECT_EQ(val1, val2)
#define EXPECT_METRIC_EQ_WAIT(val1, val2, timeout) \
EXPECT_EQ_WAIT(val1, val2, timeout)
#define EXPECT_METRIC_GT(val1, val2) EXPECT_GT(val1, val2)
#define EXPECT_METRIC_LE(val1, val2) EXPECT_LE(val1, val2)
#define EXPECT_METRIC_TRUE(conditon) EXPECT_TRUE(conditon)
#define EXPECT_METRIC_FALSE(conditon) EXPECT_FALSE(conditon)
#define EXPECT_METRIC_THAT(value, matcher) EXPECT_THAT(value, matcher)
#else
#define EXPECT_METRIC_EQ(val1, val2) webrtc::metrics_impl::NoOp(val1, val2)
#define EXPECT_METRIC_EQ_WAIT(val1, val2, timeout) webrtc::metrics_impl::NoOp(val1, val2, timeout)
#define EXPECT_METRIC_GT(val1, val2) webrtc::metrics_impl::NoOp(val1, val2)
#define EXPECT_METRIC_LE(val1, val2) webrtc::metrics_impl::NoOp(val1, val2)
#define EXPECT_METRIC_TRUE(condition) webrtc::metrics_impl::NoOp(condition || true)
#define EXPECT_METRIC_FALSE(condition) webrtc::metrics_impl::NoOp(condition && false)
#define EXPECT_METRIC_THAT(value, matcher) webrtc::metrics_impl::NoOp(value, testing::_)
#endif
#if RTC_METRICS_ENABLED
// Macros for allowing WebRTC clients (e.g. Chrome) to gather and aggregate
// statistics.
//
@ -241,6 +274,91 @@
} \
} while (0)
#else
////////////////////////////////////////////////////////////////////////////////
// This section defines no-op alternatives to the metrics macros when
// RTC_METRICS_ENABLED is defined.
#define RTC_HISTOGRAM_COUNTS_100(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_200(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_500(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_1000(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_10000(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_100000(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \
webrtc::metrics_impl::NoOp(name, sample, min, max, bucket_count)
#define RTC_HISTOGRAM_COUNTS_LINEAR(name, sample, min, max, bucket_count) \
webrtc::metrics_impl::NoOp(name, sample, min, max, bucket_count)
#define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_SPARSE_200(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_SPARSE_500(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_SPARSE_1000(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_SPARSE_10000(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_SPARSE_100000(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \
webrtc::metrics_impl::NoOp(name, sample, min, max, bucket_count)
#define RTC_HISTOGRAM_PERCENTAGE_SPARSE(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_BOOLEAN_SPARSE(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, boundary) \
webrtc::metrics_impl::NoOp(name, sample, boundary)
#define RTC_HISTOGRAM_PERCENTAGE(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_BOOLEAN(name, sample) webrtc::metrics_impl::NoOp(name, sample)
#define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \
webrtc::metrics_impl::NoOp(name, sample, boundary)
#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \
factory_get_invocation) \
webrtc::metrics_impl::NoOp(constant_name, sample, factory_get_invocation)
#define RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, factory_get_invocation) \
webrtc::metrics_impl::NoOp(name, sample, factory_get_invocation)
#define RTC_HISTOGRAMS_COUNTS_100(index, name, sample) webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_COUNTS_200(index, name, sample) webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_COUNTS_500(index, name, sample) webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_COUNTS_1000(index, name, sample) \
webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_COUNTS_10000(index, name, sample) \
webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_COUNTS_100000(index, name, sample) \
webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_ENUMERATION(index, name, sample, boundary) \
webrtc::metrics_impl::NoOp(index, name, sample, boundary)
#define RTC_HISTOGRAMS_PERCENTAGE(index, name, sample) webrtc::metrics_impl::NoOp(index, name, sample)
#define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) \
webrtc::metrics_impl::NoOp(index, name, sample, macro_invocation)
#endif // RTC_METRICS_ENABLED
namespace webrtc {
namespace metrics {

View File

@ -17,6 +17,7 @@
#include "system_wrappers/include/metrics.h"
#include "test/gtest.h"
#if RTC_METRICS_ENABLED
namespace webrtc {
namespace {
@ -164,3 +165,4 @@ TEST_F(MetricsDefaultTest, TestMinMaxBucket) {
}
} // namespace webrtc
#endif

View File

@ -17,6 +17,7 @@ using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::Pair;
#if RTC_METRICS_ENABLED
namespace webrtc {
namespace {
const int kSample = 22;
@ -130,3 +131,4 @@ TEST_F(MetricsTest, RtcHistogramSparse_NonConstantNameWorks) {
}
} // namespace webrtc
#endif

View File

@ -315,10 +315,11 @@ TEST_F(CallStatsTest, ProducesHistogramMetrics) {
process_thread_->Stop();
call_stats_.UpdateHistogramsForTest();
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.AverageRoundTripTimeInMilliseconds"));
EXPECT_EQ(1, metrics::NumEvents(
"WebRTC.Video.AverageRoundTripTimeInMilliseconds", kRtt));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.AverageRoundTripTimeInMilliseconds"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.AverageRoundTripTimeInMilliseconds",
kRtt));
}
} // namespace webrtc

View File

@ -150,113 +150,146 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
const std::string video_suffix = screenshare ? ".S0" : "";
// Verify that stats have been updated once.
EXPECT_EQ(2, metrics::NumSamples("WebRTC.Call.LifetimeInSeconds"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Call.TimeReceivingVideoRtpPacketsInSeconds"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Call.VideoBitrateReceivedInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Call.RtcpBitrateReceivedInBps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Call.BitrateReceivedInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Call.EstimatedSendBitrateInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Call.PacerBitrateInKbps"));
EXPECT_METRIC_EQ(2, metrics::NumSamples("WebRTC.Call.LifetimeInSeconds"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Call.TimeReceivingVideoRtpPacketsInSeconds"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Call.VideoBitrateReceivedInKbps"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Call.RtcpBitrateReceivedInBps"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Call.BitrateReceivedInKbps"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Call.EstimatedSendBitrateInKbps"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Call.PacerBitrateInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.SendStreamLifetimeInSeconds"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.SendStreamLifetimeInSeconds"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.NackPacketsSentPerMinute"));
EXPECT_EQ(1,
metrics::NumSamples(video_prefix + "NackPacketsReceivedPerMinute"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.FirPacketsSentPerMinute"));
EXPECT_EQ(1,
metrics::NumSamples(video_prefix + "FirPacketsReceivedPerMinute"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.PliPacketsSentPerMinute"));
EXPECT_EQ(1,
metrics::NumSamples(video_prefix + "PliPacketsReceivedPerMinute"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.NackPacketsSentPerMinute"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "NackPacketsReceivedPerMinute"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.FirPacketsSentPerMinute"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "FirPacketsReceivedPerMinute"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.PliPacketsSentPerMinute"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "PliPacketsReceivedPerMinute"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "KeyFramesSentInPermille"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "KeyFramesSentInPermille"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentPacketsLostInPercent"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "SentPacketsLostInPercent"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputWidthInPixels"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputHeightInPixels"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentWidthInPixels"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentHeightInPixels"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "ReceivedWidthInPixels"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "ReceivedHeightInPixels"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "InputWidthInPixels"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "InputHeightInPixels"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "SentWidthInPixels"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "SentHeightInPixels"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "ReceivedWidthInPixels"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "ReceivedHeightInPixels"));
EXPECT_EQ(1, metrics::NumEvents(video_prefix + "InputWidthInPixels",
kDefaultWidth));
EXPECT_EQ(1, metrics::NumEvents(video_prefix + "InputHeightInPixels",
kDefaultHeight));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "InputWidthInPixels",
kDefaultWidth));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "InputHeightInPixels",
kDefaultHeight));
EXPECT_METRIC_EQ(
1, metrics::NumEvents(video_prefix + "SentWidthInPixels", kDefaultWidth));
EXPECT_EQ(1, metrics::NumEvents(video_prefix + "SentHeightInPixels",
kDefaultHeight));
EXPECT_EQ(1, metrics::NumEvents(video_prefix + "ReceivedWidthInPixels",
kDefaultWidth));
EXPECT_EQ(1, metrics::NumEvents(video_prefix + "ReceivedHeightInPixels",
kDefaultHeight));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "SentHeightInPixels",
kDefaultHeight));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "ReceivedWidthInPixels",
kDefaultWidth));
EXPECT_METRIC_EQ(1,
metrics::NumEvents(video_prefix + "ReceivedHeightInPixels",
kDefaultHeight));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InputFramesPerSecond"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SentFramesPerSecond"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "InputFramesPerSecond"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "SentFramesPerSecond"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "EndToEndDelayInMs" +
video_suffix));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "EndToEndDelayMaxInMs" +
video_suffix));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InterframeDelayInMs" +
video_suffix));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "InterframeDelayMaxInMs" +
video_suffix));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "EndToEndDelayInMs" +
video_suffix));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "EndToEndDelayMaxInMs" +
video_suffix));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "InterframeDelayInMs" +
video_suffix));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "InterframeDelayMaxInMs" +
video_suffix));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "EncodeTimeInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DecodeTimeInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "EncodeTimeInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.DecodeTimeInMs"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "NumberOfPauseEvents"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "PausedTimeInPercent"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "NumberOfPauseEvents"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "PausedTimeInPercent"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "BitrateSentInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BitrateReceivedInKbps"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "MediaBitrateSentInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.MediaBitrateReceivedInKbps"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "PaddingBitrateSentInKbps"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.PaddingBitrateReceivedInKbps"));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "BitrateSentInKbps"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.BitrateReceivedInKbps"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "MediaBitrateSentInKbps"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.MediaBitrateReceivedInKbps"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "PaddingBitrateSentInKbps"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.PaddingBitrateReceivedInKbps"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "RetransmittedBitrateSentInKbps"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.RetransmittedBitrateReceivedInKbps"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.RetransmittedBitrateReceivedInKbps"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.SendDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SendSideDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples(video_prefix + "SendSideDelayMaxInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.SendDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(video_prefix + "SendSideDelayInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "SendSideDelayMaxInMs"));
int num_rtx_samples = use_rtx ? 1 : 0;
EXPECT_EQ(num_rtx_samples,
metrics::NumSamples("WebRTC.Video.RtxBitrateSentInKbps"));
EXPECT_EQ(num_rtx_samples,
metrics::NumSamples("WebRTC.Video.RtxBitrateReceivedInKbps"));
EXPECT_METRIC_EQ(num_rtx_samples,
metrics::NumSamples("WebRTC.Video.RtxBitrateSentInKbps"));
EXPECT_METRIC_EQ(
num_rtx_samples,
metrics::NumSamples("WebRTC.Video.RtxBitrateReceivedInKbps"));
int num_red_samples = use_fec ? 1 : 0;
EXPECT_EQ(num_red_samples,
metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps"));
EXPECT_EQ(num_red_samples,
metrics::NumSamples("WebRTC.Video.FecBitrateReceivedInKbps"));
EXPECT_EQ(num_red_samples,
metrics::NumSamples("WebRTC.Video.ReceivedFecPacketsInPercent"));
EXPECT_METRIC_EQ(num_red_samples,
metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps"));
EXPECT_METRIC_EQ(
num_red_samples,
metrics::NumSamples("WebRTC.Video.FecBitrateReceivedInKbps"));
EXPECT_METRIC_EQ(
num_red_samples,
metrics::NumSamples("WebRTC.Video.ReceivedFecPacketsInPercent"));
}
TEST_F(HistogramTest, VerifyStatsWithRtx) {

View File

@ -589,18 +589,19 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
});
// Verify that stats have been updated for both screenshare and video.
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.EndToEndDelayInMs"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.EndToEndDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.EndToEndDelayMaxInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.EndToEndDelayInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.EndToEndDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.EndToEndDelayMaxInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.EndToEndDelayMaxInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
}
TEST_F(StatsEndToEndTest, VerifyNackStats) {
@ -709,11 +710,12 @@ TEST_F(StatsEndToEndTest, VerifyNackStats) {
metrics::Reset();
RunBaseTest(&test);
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.UniqueNackRequestsSentInPercent"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.UniqueNackRequestsReceivedInPercent"));
EXPECT_GT(metrics::MinSample("WebRTC.Video.NackPacketsSentPerMinute"), 0);
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.UniqueNackRequestsReceivedInPercent"));
EXPECT_METRIC_GT(metrics::MinSample("WebRTC.Video.NackPacketsSentPerMinute"),
0);
}
TEST_F(StatsEndToEndTest, CallReportsRttForSender) {

View File

@ -101,8 +101,10 @@ TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsReported) {
}
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DecodedFramesPerSecond", kFps));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DecodedFramesPerSecond", kFps));
}
TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsNotReportedForTooFewSamples) {
@ -116,7 +118,8 @@ TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsNotReportedForTooFewSamples) {
}
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.DecodedFramesPerSecond"));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -592,10 +595,11 @@ TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) {
statistics_proxy_->OnCompleteFrame(true, 1000, VideoContentType::UNSPECIFIED);
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceiveStreamLifetimeInSeconds",
kTimeSec));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.ReceiveStreamLifetimeInSeconds",
kTimeSec));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -605,8 +609,8 @@ TEST_F(ReceiveStatisticsProxyTest,
// No frames received.
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0,
metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
}
TEST_F(ReceiveStatisticsProxyTest, BadCallHistogramsAreUpdated) {
@ -627,21 +631,23 @@ TEST_F(ReceiveStatisticsProxyTest, BadCallHistogramsAreUpdated) {
statistics_proxy_->OnRenderedFrame(frame);
}
statistics_proxy_->UpdateHistograms(absl::nullopt, counters, nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BadCall.Any"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.BadCall.Any", 100));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.BadCall.Any"));
EXPECT_METRIC_EQ(1, metrics::NumEvents("WebRTC.Video.BadCall.Any", 100));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BadCall.FrameRate"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.BadCall.FrameRate", 100));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.BadCall.FrameRate"));
EXPECT_METRIC_EQ(1,
metrics::NumEvents("WebRTC.Video.BadCall.FrameRate", 100));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.BadCall.FrameRateVariance"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.BadCall.FrameRateVariance"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.BadCall.Qp"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.BadCall.Qp"));
}
TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) {
statistics_proxy_->UpdateHistograms(10, StreamDataCounters(), nullptr);
EXPECT_EQ(0,
metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
// Restart
SetUp();
@ -649,9 +655,9 @@ TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) {
// Min run time has passed.
fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
statistics_proxy_->UpdateHistograms(10, StreamDataCounters(), nullptr);
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.ReceivedPacketsLostInPercent", 10));
}
@ -691,9 +697,9 @@ TEST_F(ReceiveStatisticsProxyTest, AvSyncOffsetHistogramIsUpdated) {
kFreqKhz);
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.AVSyncOffsetInMs", kSyncOffsetMs));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.AVSyncOffsetInMs", kSyncOffsetMs));
}
TEST_F(ReceiveStatisticsProxyTest, RtpToNtpFrequencyOffsetHistogramIsUpdated) {
@ -717,8 +723,10 @@ TEST_F(ReceiveStatisticsProxyTest, RtpToNtpFrequencyOffsetHistogramIsUpdated) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
// Average reported: (2 + 4) / 2 = 3.
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RtpToNtpFreqOffsetInKhz"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.RtpToNtpFreqOffsetInKhz", 3));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.RtpToNtpFreqOffsetInKhz"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.RtpToNtpFreqOffsetInKhz", 3));
}
TEST_F(ReceiveStatisticsProxyTest, Vp8QpHistogramIsUpdated) {
@ -729,8 +737,8 @@ TEST_F(ReceiveStatisticsProxyTest, Vp8QpHistogramIsUpdated) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.Decoded.Vp8.Qp", kQp));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
EXPECT_METRIC_EQ(1, metrics::NumEvents("WebRTC.Video.Decoded.Vp8.Qp", kQp));
}
TEST_F(ReceiveStatisticsProxyTest, Vp8QpHistogramIsNotUpdatedForTooFewSamples) {
@ -741,7 +749,7 @@ TEST_F(ReceiveStatisticsProxyTest, Vp8QpHistogramIsNotUpdatedForTooFewSamples) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
}
TEST_F(ReceiveStatisticsProxyTest, Vp8QpHistogramIsNotUpdatedIfNoQpValue) {
@ -750,7 +758,7 @@ TEST_F(ReceiveStatisticsProxyTest, Vp8QpHistogramIsNotUpdatedIfNoQpValue) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -768,7 +776,8 @@ TEST_F(ReceiveStatisticsProxyTest,
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -786,9 +795,10 @@ TEST_F(ReceiveStatisticsProxyTest,
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 0));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 0));
}
TEST_F(ReceiveStatisticsProxyTest, KeyFrameHistogramIsUpdated) {
@ -809,8 +819,9 @@ TEST_F(ReceiveStatisticsProxyTest, KeyFrameHistogramIsUpdated) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 500));
}
@ -830,11 +841,12 @@ TEST_F(ReceiveStatisticsProxyTest, TimingHistogramsNotUpdatedForTooFewSamples) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.DecodeTimeInMs"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.TargetDelayInMs"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.DecodeTimeInMs"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.TargetDelayInMs"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs"));
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs"));
}
TEST_F(ReceiveStatisticsProxyTest, TimingHistogramsAreUpdated) {
@ -853,19 +865,20 @@ TEST_F(ReceiveStatisticsProxyTest, TimingHistogramsAreUpdated) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.JitterBufferDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.TargetDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.CurrentDelayInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.OnewayDelayInMs"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.JitterBufferDelayInMs",
kJitterBufferMs));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.TargetDelayInMs", kTargetDelayMs));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumEvents("WebRTC.Video.JitterBufferDelayInMs",
kJitterBufferMs));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.TargetDelayInMs", kTargetDelayMs));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.CurrentDelayInMs", kCurrentDelayMs));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.OnewayDelayInMs", kTargetDelayMs));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.OnewayDelayInMs", kTargetDelayMs));
}
TEST_F(ReceiveStatisticsProxyTest, DoesNotReportStaleFramerates) {
@ -910,10 +923,14 @@ TEST_F(ReceiveStatisticsProxyTest,
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.ReceivedWidthInPixels"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.ReceivedHeightInPixels"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.ReceivedWidthInPixels"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.ReceivedHeightInPixels"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
}
TEST_F(ReceiveStatisticsProxyTest, ReceivedFrameHistogramsAreUpdated) {
@ -922,14 +939,18 @@ TEST_F(ReceiveStatisticsProxyTest, ReceivedFrameHistogramsAreUpdated) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.ReceivedWidthInPixels"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.ReceivedHeightInPixels"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.ReceivedWidthInPixels", kWidth));
EXPECT_EQ(1,
metrics::NumEvents("WebRTC.Video.ReceivedHeightInPixels", kHeight));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.ReceivedWidthInPixels"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.ReceivedHeightInPixels"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.RenderFramesPerSecond"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.ReceivedWidthInPixels", kWidth));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.ReceivedHeightInPixels", kHeight));
}
TEST_F(ReceiveStatisticsProxyTest, ZeroDelayReportedIfFrameNotDelayed) {
@ -945,10 +966,12 @@ TEST_F(ReceiveStatisticsProxyTest, ZeroDelayReportedIfFrameNotDelayed) {
fake_clock_.AdvanceTimeMilliseconds((metrics::kMinRunTimeInSeconds * 1000));
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer", 0));
EXPECT_EQ(0, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer", 0));
EXPECT_METRIC_EQ(0, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -966,9 +989,10 @@ TEST_F(ReceiveStatisticsProxyTest,
1);
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_EQ(0, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_METRIC_EQ(0, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -981,9 +1005,10 @@ TEST_F(ReceiveStatisticsProxyTest,
fake_clock_.AdvanceTimeMilliseconds((metrics::kMinRunTimeInSeconds * 1000));
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_EQ(0, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_METRIC_EQ(0, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
}
TEST_F(ReceiveStatisticsProxyTest, DelayReportedIfFrameIsDelayed) {
@ -999,12 +1024,15 @@ TEST_F(ReceiveStatisticsProxyTest, DelayReportedIfFrameIsDelayed) {
fake_clock_.AdvanceTimeMilliseconds((metrics::kMinRunTimeInSeconds * 1000));
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer", 100));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_EQ(1, metrics::NumEvents(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs", 1));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer", 100));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs",
1));
}
TEST_F(ReceiveStatisticsProxyTest, AverageDelayOfDelayedFramesIsReported) {
@ -1023,12 +1051,15 @@ TEST_F(ReceiveStatisticsProxyTest, AverageDelayOfDelayedFramesIsReported) {
fake_clock_.AdvanceTimeMilliseconds((metrics::kMinRunTimeInSeconds * 1000));
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer", 50));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_EQ(1, metrics::NumEvents(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs", 8));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.DelayedFramesToRenderer"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer", 50));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DelayedFramesToRenderer_AvgDelayInMs",
8));
}
TEST_F(ReceiveStatisticsProxyTest,
@ -1043,9 +1074,12 @@ TEST_F(ReceiveStatisticsProxyTest,
statistics_proxy_->RtcpPacketTypesCounterUpdated(kRemoteSsrc, counter);
statistics_proxy_->UpdateHistograms(absl::nullopt, data_counters, nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FirPacketsSentPerMinute"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.PliPacketsSentPerMinute"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.NackPacketsSentPerMinute"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.FirPacketsSentPerMinute"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.PliPacketsSentPerMinute"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.NackPacketsSentPerMinute"));
}
TEST_F(ReceiveStatisticsProxyTest, RtcpHistogramsAreUpdated) {
@ -1064,16 +1098,19 @@ TEST_F(ReceiveStatisticsProxyTest, RtcpHistogramsAreUpdated) {
statistics_proxy_->RtcpPacketTypesCounterUpdated(kRemoteSsrc, counter);
statistics_proxy_->UpdateHistograms(absl::nullopt, data_counters, nullptr);
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.FirPacketsSentPerMinute"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.PliPacketsSentPerMinute"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.NackPacketsSentPerMinute"));
EXPECT_EQ(
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.FirPacketsSentPerMinute"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.PliPacketsSentPerMinute"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.NackPacketsSentPerMinute"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.FirPacketsSentPerMinute",
kFirPackets * 60 / metrics::kMinRunTimeInSeconds));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.PliPacketsSentPerMinute",
kPliPackets * 60 / metrics::kMinRunTimeInSeconds));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.NackPacketsSentPerMinute",
kNackPackets * 60 / metrics::kMinRunTimeInSeconds));
}
@ -1162,17 +1199,17 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, InterFrameDelaysAreReported) {
kInterFrameDelayMs * 2) /
kMinRequiredSamples;
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(
EXPECT_METRIC_EQ(
kExpectedInterFrame,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
kInterFrameDelayMs * 2,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
} else {
EXPECT_EQ(kExpectedInterFrame,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(kInterFrameDelayMs * 2,
metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(kExpectedInterFrame,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(kInterFrameDelayMs * 2,
metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
}
}
@ -1199,11 +1236,12 @@ TEST_P(ReceiveStatisticsProxyTestWithContent,
nullptr);
const int kExpectedInterFrame = kInterFrameDelayMs * 2;
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(kExpectedInterFrame,
metrics::MinSample(
"WebRTC.Video.Screenshare.InterframeDelay95PercentileInMs"));
EXPECT_METRIC_EQ(
kExpectedInterFrame,
metrics::MinSample(
"WebRTC.Video.Screenshare.InterframeDelay95PercentileInMs"));
} else {
EXPECT_EQ(
EXPECT_METRIC_EQ(
kExpectedInterFrame,
metrics::MinSample("WebRTC.Video.InterframeDelay95PercentileInMs"));
}
@ -1223,12 +1261,13 @@ TEST_P(ReceiveStatisticsProxyTestWithContent,
// means we're one frame short of having a valid data set.
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(0,
metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(
0, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(0, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(0, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
}
TEST_P(ReceiveStatisticsProxyTestWithContent, MaxInterFrameDelayOnlyWithPause) {
@ -1254,23 +1293,25 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, MaxInterFrameDelayOnlyWithPause) {
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(
kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
} else {
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_EQ(kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
}
}
@ -1297,22 +1338,23 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, FreezesAreReported) {
kInterFrameDelayMs * (kMinRequiredSamples - 1);
const int kExpectedNumberFreezesPerMinute = 60 * 1000 / kCallDurationMs;
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(
EXPECT_METRIC_EQ(
kFreezeDelayMs + kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.Screenshare.MeanFreezeDurationMs"));
EXPECT_EQ(kExpectedTimeBetweenFreezes,
metrics::MinSample(
"WebRTC.Video.Screenshare.MeanTimeBetweenFreezesMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(kExpectedTimeBetweenFreezes,
metrics::MinSample(
"WebRTC.Video.Screenshare.MeanTimeBetweenFreezesMs"));
EXPECT_METRIC_EQ(
kExpectedNumberFreezesPerMinute,
metrics::MinSample("WebRTC.Video.Screenshare.NumberFreezesPerMinute"));
} else {
EXPECT_EQ(kFreezeDelayMs + kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
EXPECT_EQ(kExpectedTimeBetweenFreezes,
metrics::MinSample("WebRTC.Video.MeanTimeBetweenFreezesMs"));
EXPECT_EQ(kExpectedNumberFreezesPerMinute,
metrics::MinSample("WebRTC.Video.NumberFreezesPerMinute"));
EXPECT_METRIC_EQ(kFreezeDelayMs + kInterFrameDelayMs,
metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
EXPECT_METRIC_EQ(
kExpectedTimeBetweenFreezes,
metrics::MinSample("WebRTC.Video.MeanTimeBetweenFreezesMs"));
EXPECT_METRIC_EQ(kExpectedNumberFreezesPerMinute,
metrics::MinSample("WebRTC.Video.NumberFreezesPerMinute"));
}
}
@ -1354,11 +1396,12 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, HarmonicFrameRateIsReported) {
const int kExpectedHarmonicFrameRateFps =
std::round(kCallDurationMs / (1000 * kSumSquaredFrameDurationSecs));
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(kExpectedHarmonicFrameRateFps,
metrics::MinSample("WebRTC.Video.Screenshare.HarmonicFrameRate"));
EXPECT_METRIC_EQ(
kExpectedHarmonicFrameRateFps,
metrics::MinSample("WebRTC.Video.Screenshare.HarmonicFrameRate"));
} else {
EXPECT_EQ(kExpectedHarmonicFrameRateFps,
metrics::MinSample("WebRTC.Video.HarmonicFrameRate"));
EXPECT_METRIC_EQ(kExpectedHarmonicFrameRateFps,
metrics::MinSample("WebRTC.Video.HarmonicFrameRate"));
}
}
@ -1389,15 +1432,17 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, PausesAreIgnored) {
const int kExpectedTimeBetweenFreezes =
kInterFrameDelayMs * kMinRequiredSamples * 2;
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(-1, metrics::MinSample(
"WebRTC.Video.Screenshare.MeanFreezeDurationMs"));
EXPECT_EQ(kExpectedTimeBetweenFreezes,
metrics::MinSample(
"WebRTC.Video.Screenshare.MeanTimeBetweenFreezesMs"));
EXPECT_METRIC_EQ(-1, metrics::MinSample(
"WebRTC.Video.Screenshare.MeanFreezeDurationMs"));
EXPECT_METRIC_EQ(kExpectedTimeBetweenFreezes,
metrics::MinSample(
"WebRTC.Video.Screenshare.MeanTimeBetweenFreezesMs"));
} else {
EXPECT_EQ(-1, metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
EXPECT_EQ(kExpectedTimeBetweenFreezes,
metrics::MinSample("WebRTC.Video.MeanTimeBetweenFreezesMs"));
EXPECT_METRIC_EQ(-1,
metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
EXPECT_METRIC_EQ(
kExpectedTimeBetweenFreezes,
metrics::MinSample("WebRTC.Video.MeanTimeBetweenFreezesMs"));
}
}
@ -1421,10 +1466,11 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, ManyPausesAtTheBeginning) {
nullptr);
// No freezes should be detected, as all long inter-frame delays were pauses.
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(-1, metrics::MinSample(
"WebRTC.Video.Screenshare.MeanFreezeDurationMs"));
EXPECT_METRIC_EQ(-1, metrics::MinSample(
"WebRTC.Video.Screenshare.MeanFreezeDurationMs"));
} else {
EXPECT_EQ(-1, metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
EXPECT_METRIC_EQ(-1,
metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
}
}
@ -1454,12 +1500,12 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, TimeInHdReported) {
nullptr);
const int kExpectedTimeInHdPercents = 33;
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(
EXPECT_METRIC_EQ(
kExpectedTimeInHdPercents,
metrics::MinSample("WebRTC.Video.Screenshare.TimeInHdPercentage"));
} else {
EXPECT_EQ(kExpectedTimeInHdPercents,
metrics::MinSample("WebRTC.Video.TimeInHdPercentage"));
EXPECT_METRIC_EQ(kExpectedTimeInHdPercents,
metrics::MinSample("WebRTC.Video.TimeInHdPercentage"));
}
}
@ -1489,12 +1535,14 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, TimeInBlockyVideoReported) {
nullptr);
const int kExpectedTimeInHdPercents = 66;
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(kExpectedTimeInHdPercents,
metrics::MinSample(
"WebRTC.Video.Screenshare.TimeInBlockyVideoPercentage"));
EXPECT_METRIC_EQ(
kExpectedTimeInHdPercents,
metrics::MinSample(
"WebRTC.Video.Screenshare.TimeInBlockyVideoPercentage"));
} else {
EXPECT_EQ(kExpectedTimeInHdPercents,
metrics::MinSample("WebRTC.Video.TimeInBlockyVideoPercentage"));
EXPECT_METRIC_EQ(
kExpectedTimeInHdPercents,
metrics::MinSample("WebRTC.Video.TimeInBlockyVideoPercentage"));
}
}
@ -1523,14 +1571,14 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, DownscalesReported) {
nullptr);
const int kExpectedDownscales = 30; // 2 per 4 seconds = 30 per minute.
if (videocontenttypehelpers::IsScreenshare(content_type_)) {
EXPECT_EQ(
EXPECT_METRIC_EQ(
kExpectedDownscales,
metrics::MinSample(
"WebRTC.Video.Screenshare.NumberResolutionDownswitchesPerMinute"));
} else {
EXPECT_EQ(kExpectedDownscales,
metrics::MinSample(
"WebRTC.Video.NumberResolutionDownswitchesPerMinute"));
EXPECT_METRIC_EQ(kExpectedDownscales,
metrics::MinSample(
"WebRTC.Video.NumberResolutionDownswitchesPerMinute"));
}
}
@ -1547,7 +1595,8 @@ TEST_P(ReceiveStatisticsProxyTestWithContent, DecodeTimeReported) {
}
statistics_proxy_->UpdateHistograms(absl::nullopt, StreamDataCounters(),
nullptr);
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.DecodeTimeInMs", kDecodeMs));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.DecodeTimeInMs", kDecodeMs));
}
TEST_P(ReceiveStatisticsProxyTestWithContent,
@ -1574,62 +1623,71 @@ TEST_P(ReceiveStatisticsProxyTestWithContent,
nullptr);
if (videocontenttypehelpers::IsScreenshare(content_type)) {
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayInMs.S0"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S0"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayInMs.S1"));
EXPECT_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S1"));
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"
".ExperimentGroup0"));
EXPECT_EQ(
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayInMs.S0"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S0"));
EXPECT_METRIC_EQ(1, metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayInMs.S1"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(
"WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S1"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"
".ExperimentGroup0"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayMaxInMs"
".ExperimentGroup0"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
kInterFrameDelayMs1,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs.S0"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
kInterFrameDelayMs2,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs.S1"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
(kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
kInterFrameDelayMs2,
metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
(kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
metrics::MinSample(
"WebRTC.Video.Screenshare.InterframeDelayInMs.ExperimentGroup0"));
} else {
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S0"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S0"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S1"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S1"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"
".ExperimentGroup0"));
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"
".ExperimentGroup0"));
EXPECT_EQ(kInterFrameDelayMs1,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs.S0"));
EXPECT_EQ(kInterFrameDelayMs2,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs.S1"));
EXPECT_EQ((kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
EXPECT_EQ(kInterFrameDelayMs2,
metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_EQ((kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
metrics::MinSample(
"WebRTC.Video.InterframeDelayInMs.ExperimentGroup0"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S0"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S0"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S1"));
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S1"));
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"
".ExperimentGroup0"));
EXPECT_METRIC_EQ(1,
metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"
".ExperimentGroup0"));
EXPECT_METRIC_EQ(kInterFrameDelayMs1,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs.S0"));
EXPECT_METRIC_EQ(kInterFrameDelayMs2,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs.S1"));
EXPECT_METRIC_EQ((kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
EXPECT_METRIC_EQ(kInterFrameDelayMs2,
metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
EXPECT_METRIC_EQ((kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
metrics::MinSample(
"WebRTC.Video.InterframeDelayInMs.ExperimentGroup0"));
}
}
@ -1684,10 +1742,10 @@ TEST_P(ReceiveStatisticsProxyTestWithDecodeTimeHistograms,
fake_clock_.AdvanceTimeMilliseconds(kFrameDurationMs);
}
EXPECT_EQ(expected_number_of_samples_,
metrics::NumSamples(uma_histogram_name_));
EXPECT_EQ(expected_number_of_samples_,
metrics::NumEvents(uma_histogram_name_, kDecodeTimeMs));
EXPECT_METRIC_EQ(expected_number_of_samples_,
metrics::NumSamples(uma_histogram_name_));
EXPECT_METRIC_EQ(expected_number_of_samples_,
metrics::NumEvents(uma_histogram_name_, kDecodeTimeMs));
}
const auto kVp94kHw = std::make_tuple(/*killswitch=*/false,

View File

@ -123,9 +123,11 @@ TEST_F(SendDelayStatsTest, HistogramsAreUpdated) {
EXPECT_TRUE(OnSentPacket(id));
}
stats_.reset();
EXPECT_EQ(2, metrics::NumSamples("WebRTC.Video.SendDelayInMs"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.SendDelayInMs", kDelayMs1));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.SendDelayInMs", kDelayMs2));
EXPECT_METRIC_EQ(2, metrics::NumSamples("WebRTC.Video.SendDelayInMs"));
EXPECT_METRIC_EQ(1,
metrics::NumEvents("WebRTC.Video.SendDelayInMs", kDelayMs1));
EXPECT_METRIC_EQ(1,
metrics::NumEvents("WebRTC.Video.SendDelayInMs", kDelayMs2));
}
} // namespace webrtc

File diff suppressed because it is too large Load Diff

View File

@ -3218,9 +3218,9 @@ TEST_F(VideoStreamEncoderTest, CpuLimitedHistogramIsReported) {
video_stream_encoder_.reset();
stats_proxy_.reset();
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent"));
EXPECT_EQ(
EXPECT_METRIC_EQ(
1, metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent"));
EXPECT_METRIC_EQ(
1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50));
}

View File

@ -252,6 +252,9 @@ declare_args() {
# Set this to true to disable detailed error message and logging for
# RTC_CHECKs.
rtc_disable_check_msg = false
# Set this to true to disable webrtc metrics.
rtc_disable_metrics = true
}
# Make it possible to provide custom locations for some libraries (move these