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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.JitterBufferDelayInMs", 505 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.JitterBufferDelayInMs",
506 kJitterBufferMs)); 506 kJitterBufferMs));
507 EXPECT_EQ(1, 507 EXPECT_EQ(1,
508 metrics::NumEvents("WebRTC.Video.TargetDelayInMs", kTargetDelayMs)); 508 metrics::NumEvents("WebRTC.Video.TargetDelayInMs", kTargetDelayMs));
509 EXPECT_EQ( 509 EXPECT_EQ(
510 1, metrics::NumEvents("WebRTC.Video.CurrentDelayInMs", kCurrentDelayMs)); 510 1, metrics::NumEvents("WebRTC.Video.CurrentDelayInMs", kCurrentDelayMs));
511 EXPECT_EQ(1, 511 EXPECT_EQ(1,
512 metrics::NumEvents("WebRTC.Video.OnewayDelayInMs", kTargetDelayMs)); 512 metrics::NumEvents("WebRTC.Video.OnewayDelayInMs", kTargetDelayMs));
513 } 513 }
514 514
515 TEST_F(ReceiveStatisticsProxyTest, DoesNotReportStaleFramerates) {
516 const int kDefaultFps = 30;
517 const int kWidth = 320;
518 const int kHeight = 240;
519
520 rtc::scoped_refptr<VideoFrameBuffer> video_frame_buffer(
521 I420Buffer::Create(kWidth, kHeight));
522 VideoFrame frame(video_frame_buffer, kVideoRotation_0, 0);
523
524 for (int i = 0; i < kDefaultFps; ++i) {
525 // Since OnRenderedFrame is never called the fps in each sample will be 0,
526 // i.e. bad
527 frame.set_ntp_time_ms(fake_clock_.CurrentNtpInMilliseconds());
528 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(),
529 VideoContentType::UNSPECIFIED);
530 statistics_proxy_->OnRenderedFrame(frame);
531 fake_clock_.AdvanceTimeMilliseconds(1000 / kDefaultFps);
532 }
533
534 EXPECT_EQ(kDefaultFps, statistics_proxy_->GetStats().decode_frame_rate);
535 EXPECT_EQ(kDefaultFps, statistics_proxy_->GetStats().render_frame_rate);
536
537 // FPS trackers in stats proxy have a 1000ms sliding window.
538 fake_clock_.AdvanceTimeMilliseconds(1000);
539 EXPECT_EQ(0, statistics_proxy_->GetStats().decode_frame_rate);
540 EXPECT_EQ(0, statistics_proxy_->GetStats().render_frame_rate);
541 }
542
515 } // namespace webrtc 543 } // namespace webrtc
OLDNEW
« 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