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

Unified Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 2861663002: Update decode/render fps stats when calling VideoReceiveStream::GetStats (Closed)
Patch Set: Added unit test Created 3 years, 8 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 36f5346900dc40e3aae5667a46572b8d6d8780e8..8344c698eca670f4f8ee565164827770aaf317cd 100644
--- a/webrtc/video/receive_statistics_proxy_unittest.cc
+++ b/webrtc/video/receive_statistics_proxy_unittest.cc
@@ -512,4 +512,32 @@ TEST_F(ReceiveStatisticsProxyTest, TimingHistogramsAreUpdated) {
metrics::NumEvents("WebRTC.Video.OnewayDelayInMs", kTargetDelayMs));
}
+TEST_F(ReceiveStatisticsProxyTest, DoesNotReportStaleFramerates) {
+ const int kDefaultFps = 30;
+ const int kWidth = 320;
+ const int kHeight = 240;
+
+ rtc::scoped_refptr<VideoFrameBuffer> video_frame_buffer(
+ I420Buffer::Create(kWidth, kHeight));
+ VideoFrame frame(video_frame_buffer, kVideoRotation_0, 0);
+
+ for (int i = 0; i < kDefaultFps; ++i) {
+ // Since OnRenderedFrame is never called the fps in each sample will be 0,
+ // i.e. bad
+ frame.set_ntp_time_ms(fake_clock_.CurrentNtpInMilliseconds());
+ statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(),
+ VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnRenderedFrame(frame);
+ fake_clock_.AdvanceTimeMilliseconds(1000 / kDefaultFps);
+ }
+
+ EXPECT_EQ(kDefaultFps, statistics_proxy_->GetStats().decode_frame_rate);
+ EXPECT_EQ(kDefaultFps, statistics_proxy_->GetStats().render_frame_rate);
+
+ // FPS trackers in stats proxy have a 1000ms sliding window.
+ fake_clock_.AdvanceTimeMilliseconds(1000);
+ EXPECT_EQ(0, statistics_proxy_->GetStats().decode_frame_rate);
+ EXPECT_EQ(0, statistics_proxy_->GetStats().render_frame_rate);
+}
+
} // 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