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

Unified Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 2986893002: Piggybacking simulcast id and ALR experiment id into video content type extension. (Closed)
Patch Set: use namespace instead of struct Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/receive_statistics_proxy_unittest.cc
diff --git a/webrtc/video/receive_statistics_proxy_unittest.cc b/webrtc/video/receive_statistics_proxy_unittest.cc
index 98ec7eddad24409ec3097b6c6568c3190be064a3..528ef09c88003d42a65f8e997d9f689e7ea36644 100644
--- a/webrtc/video/receive_statistics_proxy_unittest.cc
+++ b/webrtc/video/receive_statistics_proxy_unittest.cc
@@ -203,7 +203,8 @@ TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecoderImplementationName) {
TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsOnCompleteFrame) {
const int kFrameSizeBytes = 1000;
- statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes);
+ statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes,
+ VideoContentType::UNSPECIFIED);
VideoReceiveStream::Stats stats = statistics_proxy_->GetStats();
EXPECT_EQ(1, stats.network_frame_rate);
EXPECT_EQ(1, stats.frame_counts.key_frames);
@@ -352,6 +353,8 @@ TEST_F(ReceiveStatisticsProxyTest, GetTimingFrameInfoTimingFramesReportedOnce) {
TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) {
const int64_t kTimeSec = 3;
fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000);
+ // Need at least one frame to report stream lifetime.
+ statistics_proxy_->OnCompleteFrame(true, 1000, VideoContentType::UNSPECIFIED);
// Histograms are updated when the statistics_proxy_ is deleted.
statistics_proxy_.reset();
EXPECT_EQ(1,
@@ -360,6 +363,17 @@ TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) {
kTimeSec));
}
+TEST_F(ReceiveStatisticsProxyTest,
+ LifetimeHistogramNotReportedForEmptyStreams) {
+ const int64_t kTimeSec = 3;
+ fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000);
+ // No frames received.
+ // Histograms are updated when the statistics_proxy_ is deleted.
+ statistics_proxy_.reset();
+ EXPECT_EQ(0,
+ metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
+}
+
TEST_F(ReceiveStatisticsProxyTest, BadCallHistogramsAreUpdated) {
// Based on the tuning parameters this will produce 7 uncertain states,
// then 10 certainly bad states. There has to be 10 certain states before
@@ -533,7 +547,8 @@ TEST_F(ReceiveStatisticsProxyTest,
const int kFrameSizeBytes = 1000;
for (int i = 0; i < kMinRequiredSamples - 1; ++i)
- statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes);
+ statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes,
+ VideoContentType::UNSPECIFIED);
EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames);
EXPECT_EQ(kMinRequiredSamples - 1,
@@ -549,7 +564,8 @@ TEST_F(ReceiveStatisticsProxyTest,
const int kFrameSizeBytes = 1000;
for (int i = 0; i < kMinRequiredSamples; ++i)
- statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes);
+ statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes,
+ VideoContentType::UNSPECIFIED);
EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames);
EXPECT_EQ(kMinRequiredSamples,
@@ -565,10 +581,12 @@ TEST_F(ReceiveStatisticsProxyTest, KeyFrameHistogramIsUpdated) {
const int kFrameSizeBytes = 1000;
for (int i = 0; i < kMinRequiredSamples; ++i)
- statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes);
+ statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes,
+ VideoContentType::UNSPECIFIED);
for (int i = 0; i < kMinRequiredSamples; ++i)
- statistics_proxy_->OnCompleteFrame(false, kFrameSizeBytes);
+ statistics_proxy_->OnCompleteFrame(false, kFrameSizeBytes,
+ VideoContentType::UNSPECIFIED);
EXPECT_EQ(kMinRequiredSamples,
statistics_proxy_->GetStats().frame_counts.key_frames);
@@ -777,23 +795,18 @@ TEST_P(ReceiveStatisticsProxyTest, InterFrameDelaysAreReported) {
(kInterFrameDelayMs * (kMinRequiredSamples - 1) +
kInterFrameDelayMs * 2) /
kMinRequiredSamples;
- switch (content_type) {
- case VideoContentType::UNSPECIFIED:
- EXPECT_EQ(kExpectedInterFrame,
- metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
- EXPECT_EQ(kInterFrameDelayMs * 2,
- metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
- break;
- case VideoContentType::SCREENSHARE:
- EXPECT_EQ(
- kExpectedInterFrame,
- metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs"));
- EXPECT_EQ(kInterFrameDelayMs * 2,
- metrics::MinSample(
- "WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
- break;
- default:
- RTC_NOTREACHED();
+ if (videocontenttypehelpers::IsScreenshare(content_type)) {
+ EXPECT_EQ(
+ kExpectedInterFrame,
+ metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs"));
+ EXPECT_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"));
}
}
@@ -836,7 +849,7 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithPause) {
statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type);
statistics_proxy_.reset();
- if (content_type == VideoContentType::SCREENSHARE) {
+ if (videocontenttypehelpers::IsScreenshare(content_type)) {
EXPECT_EQ(
1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"));
EXPECT_EQ(1, metrics::NumSamples(
@@ -857,4 +870,84 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithPause) {
}
}
+TEST_P(ReceiveStatisticsProxyTest, StatsAreSlicedOnSimulcastAndExperiment) {
+ VideoContentType content_type = GetParam();
+ const uint8_t experiment_id = 1;
+ videocontenttypehelpers::SetExperimentId(&content_type, experiment_id);
+ const int kInterFrameDelayMs1 = 30;
+ const int kInterFrameDelayMs2 = 50;
+
+ videocontenttypehelpers::SetSimulcastId(&content_type, 1);
+ for (int i = 0; i <= kMinRequiredSamples; ++i) {
+ fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs1);
+ statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type);
+ }
+
+ videocontenttypehelpers::SetSimulcastId(&content_type, 2);
+ for (int i = 0; i <= kMinRequiredSamples; ++i) {
+ fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs2);
+ statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type);
+ }
+ statistics_proxy_.reset();
+
+ if (videocontenttypehelpers::IsScreenshare(content_type)) {
+ EXPECT_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(
+ 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayMaxInMs"
+ ".ExperimentGroup0"));
+ EXPECT_EQ(
+ kInterFrameDelayMs1,
+ metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs.S0"));
+ EXPECT_EQ(
+ kInterFrameDelayMs2,
+ metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs.S1"));
+ EXPECT_EQ(
+ (kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2,
+ metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs"));
+ EXPECT_EQ(
+ kInterFrameDelayMs2,
+ metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
+ EXPECT_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"));
+ }
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698