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

Unified Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 2385763002: Add stats for frequency offset when converting RTP timestamp to NTP time. (Closed)
Patch Set: rebase 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_streams_synchronizer.h » ('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 894ee8fe732ec837fdd31b2e57501fa11c4fe23f..b8c4b20f99a304f0a42d612c3288d85ecea76c5a 100644
--- a/webrtc/video/receive_statistics_proxy_unittest.cc
+++ b/webrtc/video/receive_statistics_proxy_unittest.cc
@@ -12,9 +12,13 @@
#include <memory>
+#include "webrtc/system_wrappers/include/metrics_default.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
+namespace {
+const int64_t kFreqOffsetProcessIntervalInMs = 40000;
+} // namespace
// TODO(sakal): ReceiveStatisticsProxy is lacking unittesting.
class ReceiveStatisticsProxyTest : public ::testing::Test {
@@ -24,6 +28,7 @@ class ReceiveStatisticsProxyTest : public ::testing::Test {
protected:
virtual void SetUp() {
+ metrics::Reset();
statistics_proxy_.reset(new ReceiveStatisticsProxy(&config_, &fake_clock_));
}
@@ -33,8 +38,8 @@ class ReceiveStatisticsProxyTest : public ::testing::Test {
}
SimulatedClock fake_clock_;
+ const VideoReceiveStream::Config config_;
std::unique_ptr<ReceiveStatisticsProxy> statistics_proxy_;
- VideoReceiveStream::Config config_;
};
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) {
@@ -45,4 +50,23 @@ TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) {
}
}
+TEST_F(ReceiveStatisticsProxyTest, RtpToNtpFrequencyOffsetHistogramIsUpdated) {
+ const int64_t kSyncOffsetMs = 22;
+ const double kFreqKhz = 90.0;
+ statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz);
+ statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz + 2.2);
+ fake_clock_.AdvanceTimeMilliseconds(kFreqOffsetProcessIntervalInMs);
+ // Process interval passed, max diff: 2.
+ statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz + 1.1);
+ statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz - 4.2);
+ statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz - 0.9);
+ fake_clock_.AdvanceTimeMilliseconds(kFreqOffsetProcessIntervalInMs);
+ // Process interval passed, max diff: 4.
+ statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz);
+ statistics_proxy_.reset();
+ // Average reported: (2 + 4) / 2 = 3.
+ EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RtpToNtpFreqOffsetInKhz"));
+ EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.RtpToNtpFreqOffsetInKhz", 3));
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/rtp_streams_synchronizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698