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

Side by Side Diff: webrtc/video/receive_statistics_proxy_unittest.cc

Issue 3008983002: Change reporting of timing frames conditions in GetStats on receive side (Closed)
Patch Set: Fix timing frames ToString implementation Created 3 years, 3 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
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str()); 301 EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str());
302 } 302 }
303 303
304 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) { 304 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) {
305 const char* kName = "cName"; 305 const char* kName = "cName";
306 statistics_proxy_->CNameChanged(kName, kRemoteSsrc + 1); 306 statistics_proxy_->CNameChanged(kName, kRemoteSsrc + 1);
307 EXPECT_STREQ("", statistics_proxy_->GetStats().c_name.c_str()); 307 EXPECT_STREQ("", statistics_proxy_->GetStats().c_name.c_str());
308 } 308 }
309 309
310 TEST_F(ReceiveStatisticsProxyTest, 310 TEST_F(ReceiveStatisticsProxyTest,
311 GetTimingFrameInfoReportsLongestTimingFrame) { 311 ReportsLongestTimingFrameInfo) {
312 const int64_t kShortEndToEndDelay = 10; 312 const int64_t kShortEndToEndDelay = 10;
313 const int64_t kMedEndToEndDelay = 20; 313 const int64_t kMedEndToEndDelay = 20;
314 const int64_t kLongEndToEndDelay = 100; 314 const int64_t kLongEndToEndDelay = 100;
315 const uint32_t kExpectedRtpTimestamp = 2; 315 const uint32_t kExpectedRtpTimestamp = 2;
316 TimingFrameInfo info; 316 TimingFrameInfo info;
317 rtc::Optional<TimingFrameInfo> result; 317 rtc::Optional<TimingFrameInfo> result;
318 info.rtp_timestamp = kExpectedRtpTimestamp - 1; 318 info.rtp_timestamp = kExpectedRtpTimestamp - 1;
319 info.capture_time_ms = 0; 319 info.capture_time_ms = 0;
320 info.decode_finish_ms = kShortEndToEndDelay; 320 info.decode_finish_ms = kShortEndToEndDelay;
321 statistics_proxy_->OnTimingFrameInfoUpdated(info); 321 statistics_proxy_->OnTimingFrameInfoUpdated(info);
322 info.rtp_timestamp = 322 info.rtp_timestamp =
323 kExpectedRtpTimestamp; // this frame should be reported in the end. 323 kExpectedRtpTimestamp; // this frame should be reported in the end.
324 info.capture_time_ms = 0; 324 info.capture_time_ms = 0;
325 info.decode_finish_ms = kLongEndToEndDelay; 325 info.decode_finish_ms = kLongEndToEndDelay;
326 statistics_proxy_->OnTimingFrameInfoUpdated(info); 326 statistics_proxy_->OnTimingFrameInfoUpdated(info);
327 info.rtp_timestamp = kExpectedRtpTimestamp + 1; 327 info.rtp_timestamp = kExpectedRtpTimestamp + 1;
328 info.capture_time_ms = 0; 328 info.capture_time_ms = 0;
329 info.decode_finish_ms = kMedEndToEndDelay; 329 info.decode_finish_ms = kMedEndToEndDelay;
330 statistics_proxy_->OnTimingFrameInfoUpdated(info); 330 statistics_proxy_->OnTimingFrameInfoUpdated(info);
331 result = statistics_proxy_->GetAndResetTimingFrameInfo(); 331 result = statistics_proxy_->GetStats().timing_frame_info;
332 EXPECT_TRUE(result); 332 EXPECT_TRUE(result);
333 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); 333 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp);
334 } 334 }
335 335
336 TEST_F(ReceiveStatisticsProxyTest, GetTimingFrameInfoTimingFramesReportedOnce) { 336 TEST_F(ReceiveStatisticsProxyTest, RespectsReportingIntervalForTimingFrames) {
337 TimingFrameInfo info;
337 const int64_t kShortEndToEndDelay = 10; 338 const int64_t kShortEndToEndDelay = 10;
338 const uint32_t kExpectedRtpTimestamp = 2; 339 const uint32_t kExpectedRtpTimestamp = 2;
339 TimingFrameInfo info; 340 const int64_t kShortDelay = 1000;
sprang_webrtc 2017/08/31 13:24:43 nit: kShortDelayMs
ilnik 2017/08/31 13:32:59 Done.
341 const int64_t kLongDelay = 10000;
340 rtc::Optional<TimingFrameInfo> result; 342 rtc::Optional<TimingFrameInfo> result;
341 info.rtp_timestamp = kExpectedRtpTimestamp; 343 info.rtp_timestamp = kExpectedRtpTimestamp;
342 info.capture_time_ms = 0; 344 info.capture_time_ms = 0;
343 info.decode_finish_ms = kShortEndToEndDelay; 345 info.decode_finish_ms = kShortEndToEndDelay;
344 statistics_proxy_->OnTimingFrameInfoUpdated(info); 346 statistics_proxy_->OnTimingFrameInfoUpdated(info);
345 result = statistics_proxy_->GetAndResetTimingFrameInfo(); 347 fake_clock_.AdvanceTimeMilliseconds(kShortDelay);
348 result = statistics_proxy_->GetStats().timing_frame_info;
346 EXPECT_TRUE(result); 349 EXPECT_TRUE(result);
347 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); 350 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp);
348 result = statistics_proxy_->GetAndResetTimingFrameInfo(); 351 fake_clock_.AdvanceTimeMilliseconds(kLongDelay);
352 result = statistics_proxy_->GetStats().timing_frame_info;
349 EXPECT_FALSE(result); 353 EXPECT_FALSE(result);
350 } 354 }
351 355
352 TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) { 356 TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) {
353 const int64_t kTimeSec = 3; 357 const int64_t kTimeSec = 3;
354 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); 358 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000);
355 // Histograms are updated when the statistics_proxy_ is deleted. 359 // Histograms are updated when the statistics_proxy_ is deleted.
356 statistics_proxy_.reset(); 360 statistics_proxy_.reset();
357 EXPECT_EQ(1, 361 EXPECT_EQ(1,
358 metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds")); 362 metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds"));
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); 855 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs"));
852 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); 856 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs"));
853 EXPECT_EQ(kInterFrameDelayMs, 857 EXPECT_EQ(kInterFrameDelayMs,
854 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); 858 metrics::MinSample("WebRTC.Video.InterframeDelayInMs"));
855 EXPECT_EQ(kInterFrameDelayMs, 859 EXPECT_EQ(kInterFrameDelayMs,
856 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); 860 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs"));
857 } 861 }
858 } 862 }
859 863
860 } // namespace webrtc 864 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698