Chromium Code Reviews| 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..3a89c9f9dae97448bc82d1e17bf8ccb3a7340570 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); |
| @@ -533,7 +534,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 +551,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 +568,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 +782,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 (content_type.IsScreenshare()) { |
| + 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 +836,7 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithPause) { |
| statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| statistics_proxy_.reset(); |
| - if (content_type == VideoContentType::SCREENSHARE) { |
| + if (content_type.IsScreenshare()) { |
| EXPECT_EQ( |
| 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
| EXPECT_EQ(1, metrics::NumSamples( |
| @@ -857,4 +857,56 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithPause) { |
| } |
| } |
| +TEST_P(ReceiveStatisticsProxyTest, StatsAreSlicedOnSimulcastAndExperiment) { |
| + VideoContentType content_type = GetParam(); |
| + const uint8_t experiment_id = 1; |
| + content_type.SetExperimentId(experiment_id); |
| + const int kInterFrameDelayMs = 33; |
| + |
| + content_type.SetSimulcastId(1); |
| + for (int i = 0; i <= kMinRequiredSamples; ++i) { |
| + statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| + fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
| + } |
| + |
| + content_type.SetSimulcastId(2); |
| + for (int i = 0; i <= kMinRequiredSamples; ++i) { |
| + statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| + fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
| + } |
| + statistics_proxy_.reset(); |
| + |
| + if (content_type.IsScreenshare()) { |
| + 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")); |
| + } 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")); |
| + } |
|
sprang_webrtc
2017/08/28 16:25:02
Can you verify the actual values for any of these
ilnik
2017/08/29 07:56:27
Done.
|
| +} |
| + |
| } // namespace webrtc |