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

Unified Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 2536653002: Update video histograms that do not have a minimum lifetime limit before being recorded. (Closed)
Patch Set: Split from https://codereview.webrtc.org/2482763003/ Created 4 years, 1 month 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/rtp_stream_receiver.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 66856a70ade72fff3c42b9a486f607e075b4c9fb..74186f040c1420fd19b13c9eba26e893e3c11b6f 100644
--- a/webrtc/video/receive_statistics_proxy_unittest.cc
+++ b/webrtc/video/receive_statistics_proxy_unittest.cc
@@ -12,6 +12,7 @@
#include <memory>
+#include "webrtc/system_wrappers/include/metrics.h"
#include "webrtc/system_wrappers/include/metrics_default.h"
#include "webrtc/test/gtest.h"
@@ -112,6 +113,64 @@ TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) {
kTimeSec));
}
+TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) {
+ const uint32_t kCumLost1 = 1;
+ const uint32_t kExtSeqNum1 = 10;
+ const uint32_t kCumLost2 = 2;
+ const uint32_t kExtSeqNum2 = 20;
+
+ // One report block received.
+ RtcpStatistics rtcp_stats1;
+ rtcp_stats1.cumulative_lost = kCumLost1;
+ rtcp_stats1.extended_max_sequence_number = kExtSeqNum1;
+ statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc);
+
+ // Two report blocks received.
+ RtcpStatistics rtcp_stats2;
+ rtcp_stats2.cumulative_lost = kCumLost2;
+ rtcp_stats2.extended_max_sequence_number = kExtSeqNum2;
+ statistics_proxy_->StatisticsUpdated(rtcp_stats2, kRemoteSsrc);
+
+ // Two received report blocks but min run time has not passed.
+ fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000 - 1);
+ SetUp(); // Reset stat proxy causes histograms to be updated.
+ EXPECT_EQ(0,
+ metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
+
+ // Two report blocks received.
+ statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc);
+ statistics_proxy_->StatisticsUpdated(rtcp_stats2, kRemoteSsrc);
+
+ // Two received report blocks and min run time has passed.
+ fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
+ SetUp();
+ EXPECT_EQ(1,
+ metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
+ EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceivedPacketsLostInPercent",
+ (kCumLost2 - kCumLost1) * 100 /
+ (kExtSeqNum2 - kExtSeqNum1)));
+}
+
+TEST_F(ReceiveStatisticsProxyTest,
+ PacketLossHistogramIsNotUpdatedIfLessThanTwoReportBlocksAreReceived) {
+ RtcpStatistics rtcp_stats1;
+ rtcp_stats1.cumulative_lost = 1;
+ rtcp_stats1.extended_max_sequence_number = 10;
+
+ // Min run time has passed but no received report block.
+ fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
+ SetUp(); // Reset stat proxy causes histograms to be updated.
+ EXPECT_EQ(0,
+ metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
+
+ // Min run time has passed but only one received report block.
+ statistics_proxy_->StatisticsUpdated(rtcp_stats1, kRemoteSsrc);
+ fake_clock_.AdvanceTimeMilliseconds(metrics::kMinRunTimeInSeconds * 1000);
+ SetUp();
+ EXPECT_EQ(0,
+ metrics::NumSamples("WebRTC.Video.ReceivedPacketsLostInPercent"));
+}
+
TEST_F(ReceiveStatisticsProxyTest, AvSyncOffsetHistogramIsUpdated) {
const int64_t kSyncOffsetMs = 22;
const double kFreqKhz = 90.0;
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/rtp_stream_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698