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

Unified Diff: webrtc/video/send_statistics_proxy_unittest.cc

Issue 1720883002: Move RTCP histograms from vie_channel to video channel stats proxies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 10 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/send_statistics_proxy.cc ('k') | webrtc/video/vie_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/send_statistics_proxy_unittest.cc
diff --git a/webrtc/video/send_statistics_proxy_unittest.cc b/webrtc/video/send_statistics_proxy_unittest.cc
index cf54190d1397c438c0df40dcfc7cedc81d81b8dd..c1120132dad373e7cb1a4c01f7959f39e53c055e 100644
--- a/webrtc/video/send_statistics_proxy_unittest.cc
+++ b/webrtc/video/send_statistics_proxy_unittest.cc
@@ -16,10 +16,16 @@
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/system_wrappers/include/metrics.h"
#include "webrtc/test/histogram.h"
namespace webrtc {
+static const uint32_t kFirstSsrc = 17;
+static const uint32_t kSecondSsrc = 42;
+static const uint32_t kFirstRtxSsrc = 18;
+static const uint32_t kSecondRtxSsrc = 43;
+
class SendStatisticsProxyTest : public ::testing::Test {
public:
SendStatisticsProxyTest()
@@ -37,10 +43,10 @@ class SendStatisticsProxyTest : public ::testing::Test {
VideoSendStream::Config GetTestConfig() {
VideoSendStream::Config config(nullptr);
- config.rtp.ssrcs.push_back(17);
- config.rtp.ssrcs.push_back(42);
- config.rtp.rtx.ssrcs.push_back(18);
- config.rtp.rtx.ssrcs.push_back(43);
+ config.rtp.ssrcs.push_back(kFirstSsrc);
+ config.rtp.ssrcs.push_back(kSecondSsrc);
+ config.rtp.rtx.ssrcs.push_back(kFirstRtxSsrc);
+ config.rtp.rtx.ssrcs.push_back(kSecondRtxSsrc);
return config;
}
@@ -86,8 +92,8 @@ class SendStatisticsProxyTest : public ::testing::Test {
}
}
- rtc::scoped_ptr<SendStatisticsProxy> statistics_proxy_;
SimulatedClock fake_clock_;
+ rtc::scoped_ptr<SendStatisticsProxy> statistics_proxy_;
VideoSendStream::Config config_;
int avg_delay_ms_;
int max_delay_ms_;
@@ -434,4 +440,89 @@ TEST_F(SendStatisticsProxyTest, ClearsBitratesFromInactiveSsrcs) {
EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps);
}
+TEST_F(SendStatisticsProxyTest, ResetsRtcpCountersOnContentChange) {
+ RtcpPacketTypeCounterObserver* proxy =
+ static_cast<RtcpPacketTypeCounterObserver*>(statistics_proxy_.get());
+ RtcpPacketTypeCounter counters;
+ counters.first_packet_time_ms = fake_clock_.TimeInMilliseconds();
+ proxy->RtcpPacketTypesCounterUpdated(kFirstSsrc, counters);
+ proxy->RtcpPacketTypesCounterUpdated(kSecondSsrc, counters);
+
+ fake_clock_.AdvanceTimeMilliseconds(1000 * metrics::kMinRunTimeInSeconds);
+
+ counters.nack_packets += 1 * metrics::kMinRunTimeInSeconds;
+ counters.fir_packets += 2 * metrics::kMinRunTimeInSeconds;
+ counters.pli_packets += 3 * metrics::kMinRunTimeInSeconds;
+ counters.unique_nack_requests += 4 * metrics::kMinRunTimeInSeconds;
+ counters.nack_requests += 5 * metrics::kMinRunTimeInSeconds;
+
+ proxy->RtcpPacketTypesCounterUpdated(kFirstSsrc, counters);
+ proxy->RtcpPacketTypesCounterUpdated(kSecondSsrc, counters);
+
+ // Changing content type causes histograms to be reported.
+ statistics_proxy_->SetContentType(VideoEncoderConfig::ContentType::kScreen);
+
+ EXPECT_EQ(1, test::NumHistogramSamples(
+ "WebRTC.Video.NackPacketsReceivedPerMinute"));
+ EXPECT_EQ(
+ 1, test::NumHistogramSamples("WebRTC.Video.FirPacketsReceivedPerMinute"));
+ EXPECT_EQ(
+ 1, test::NumHistogramSamples("WebRTC.Video.PliPacketsReceivedPerMinute"));
+ EXPECT_EQ(1, test::NumHistogramSamples(
+ "WebRTC.Video.UniqueNackRequestsReceivedInPercent"));
+
+ const int kRate = 60 * 2; // Packets per minute with two streams.
+
+ EXPECT_EQ(1 * kRate, test::LastHistogramSample(
+ "WebRTC.Video.NackPacketsReceivedPerMinute"));
+ EXPECT_EQ(2 * kRate, test::LastHistogramSample(
+ "WebRTC.Video.FirPacketsReceivedPerMinute"));
+ EXPECT_EQ(3 * kRate, test::LastHistogramSample(
+ "WebRTC.Video.PliPacketsReceivedPerMinute"));
+ EXPECT_EQ(4 * 100 / 5,
+ test::LastHistogramSample(
+ "WebRTC.Video.UniqueNackRequestsReceivedInPercent"));
+
+ // New start time but same counter values.
+ proxy->RtcpPacketTypesCounterUpdated(kFirstSsrc, counters);
+ proxy->RtcpPacketTypesCounterUpdated(kSecondSsrc, counters);
+
+ fake_clock_.AdvanceTimeMilliseconds(1000 * metrics::kMinRunTimeInSeconds);
+
+ counters.nack_packets += 1 * metrics::kMinRunTimeInSeconds;
+ counters.fir_packets += 2 * metrics::kMinRunTimeInSeconds;
+ counters.pli_packets += 3 * metrics::kMinRunTimeInSeconds;
+ counters.unique_nack_requests += 4 * metrics::kMinRunTimeInSeconds;
+ counters.nack_requests += 5 * metrics::kMinRunTimeInSeconds;
+
+ proxy->RtcpPacketTypesCounterUpdated(kFirstSsrc, counters);
+ proxy->RtcpPacketTypesCounterUpdated(kSecondSsrc, counters);
+
+ SetUp(); // Reset stats proxy also causes histograms to be reported.
+
+ EXPECT_EQ(1, test::NumHistogramSamples(
+ "WebRTC.Video.Screenshare.NackPacketsReceivedPerMinute"));
+ EXPECT_EQ(1, test::NumHistogramSamples(
+ "WebRTC.Video.Screenshare.FirPacketsReceivedPerMinute"));
+ EXPECT_EQ(1, test::NumHistogramSamples(
+ "WebRTC.Video.Screenshare.PliPacketsReceivedPerMinute"));
+ EXPECT_EQ(
+ 1, test::NumHistogramSamples(
+ "WebRTC.Video.Screenshare.UniqueNackRequestsReceivedInPercent"));
+
+ EXPECT_EQ(1 * kRate,
+ test::LastHistogramSample(
+ "WebRTC.Video.Screenshare.NackPacketsReceivedPerMinute"));
+ EXPECT_EQ(2 * kRate,
+ test::LastHistogramSample(
+ "WebRTC.Video.Screenshare.FirPacketsReceivedPerMinute"));
+ EXPECT_EQ(3 * kRate,
+ test::LastHistogramSample(
+ "WebRTC.Video.Screenshare.PliPacketsReceivedPerMinute"));
+ EXPECT_EQ(
+ 4 * 100 / 5,
+ test::LastHistogramSample(
+ "WebRTC.Video.Screenshare.UniqueNackRequestsReceivedInPercent"));
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video/vie_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698