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

Unified Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 3002593002: Fix incorrect InterframeDelayMaxInMs histogram metrics (Closed)
Patch Set: 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') | no next file » | 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 6112dd7fd4d90d6c29af35fd63194eb23a4d112f..d37d2035485334127083b21c5d572b70b1c588a2 100644
--- a/webrtc/video/receive_statistics_proxy_unittest.cc
+++ b/webrtc/video/receive_statistics_proxy_unittest.cc
@@ -30,7 +30,8 @@ const int kMinRequiredSamples = 200;
} // namespace
// TODO(sakal): ReceiveStatisticsProxy is lacking unittesting.
-class ReceiveStatisticsProxyTest : public ::testing::Test {
+class ReceiveStatisticsProxyTest
+ : public ::testing::TestWithParam<webrtc::VideoContentType> {
public:
ReceiveStatisticsProxyTest() : fake_clock_(1234), config_(GetTestConfig()) {}
virtual ~ReceiveStatisticsProxyTest() {}
@@ -718,4 +719,64 @@ TEST_F(ReceiveStatisticsProxyTest, RtcpHistogramsAreUpdated) {
kNackPackets * 60 / metrics::kMinRunTimeInSeconds));
}
+INSTANTIATE_TEST_CASE_P(ContentTypes,
+ ReceiveStatisticsProxyTest,
+ ::testing::Values(VideoContentType::UNSPECIFIED,
+ VideoContentType::SCREENSHARE));
+
+TEST_P(ReceiveStatisticsProxyTest, InterFrameDelaysAreReported) {
+ const VideoContentType content_type = GetParam();
+ const int kInterFrameDelayMs = 33;
+ for (int i = 0; i < kMinRequiredSamples; ++i) {
+ statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type);
+ fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
+ }
+ // One extra with with double the interval.
+ fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
+ statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type);
+
+ statistics_proxy_.reset();
+ const int kExpectedInterFrame =
+ (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();
+ }
+}
+
+TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) {
+ const VideoContentType content_type = GetParam();
+ const int kInterFrameDelayMs = 33;
+ for (int i = 0; i < kMinRequiredSamples; ++i) {
+ statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type);
+ fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
+ }
+
+ // |kMinRequiredSamples| samples, and thereby intervals, is required. That
+ // means we're one frame short of having a valid data set.
+ statistics_proxy_.reset();
+ EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
+ EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
+ EXPECT_EQ(
+ 0, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs"));
+ EXPECT_EQ(0, metrics::NumSamples(
+ "WebRTC.Video.Screenshare.InterframeDelayMaxInMs"));
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698