| OLD | NEW |
| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str()); | 302 EXPECT_STREQ(kName, statistics_proxy_->GetStats().c_name.c_str()); |
| 303 } | 303 } |
| 304 | 304 |
| 305 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) { | 305 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsNoCNameForUnknownSsrc) { |
| 306 const char* kName = "cName"; | 306 const char* kName = "cName"; |
| 307 statistics_proxy_->CNameChanged(kName, kRemoteSsrc + 1); | 307 statistics_proxy_->CNameChanged(kName, kRemoteSsrc + 1); |
| 308 EXPECT_STREQ("", statistics_proxy_->GetStats().c_name.c_str()); | 308 EXPECT_STREQ("", statistics_proxy_->GetStats().c_name.c_str()); |
| 309 } | 309 } |
| 310 | 310 |
| 311 TEST_F(ReceiveStatisticsProxyTest, | 311 TEST_F(ReceiveStatisticsProxyTest, |
| 312 GetTimingFrameInfoReportsLongestTimingFrame) { | 312 ReportsLongestTimingFrameInfo) { |
| 313 const int64_t kShortEndToEndDelay = 10; | 313 const int64_t kShortEndToEndDelay = 10; |
| 314 const int64_t kMedEndToEndDelay = 20; | 314 const int64_t kMedEndToEndDelay = 20; |
| 315 const int64_t kLongEndToEndDelay = 100; | 315 const int64_t kLongEndToEndDelay = 100; |
| 316 const uint32_t kExpectedRtpTimestamp = 2; | 316 const uint32_t kExpectedRtpTimestamp = 2; |
| 317 TimingFrameInfo info; | 317 TimingFrameInfo info; |
| 318 rtc::Optional<TimingFrameInfo> result; | 318 rtc::Optional<TimingFrameInfo> result; |
| 319 info.rtp_timestamp = kExpectedRtpTimestamp - 1; | 319 info.rtp_timestamp = kExpectedRtpTimestamp - 1; |
| 320 info.capture_time_ms = 0; | 320 info.capture_time_ms = 0; |
| 321 info.decode_finish_ms = kShortEndToEndDelay; | 321 info.decode_finish_ms = kShortEndToEndDelay; |
| 322 statistics_proxy_->OnTimingFrameInfoUpdated(info); | 322 statistics_proxy_->OnTimingFrameInfoUpdated(info); |
| 323 info.rtp_timestamp = | 323 info.rtp_timestamp = |
| 324 kExpectedRtpTimestamp; // this frame should be reported in the end. | 324 kExpectedRtpTimestamp; // this frame should be reported in the end. |
| 325 info.capture_time_ms = 0; | 325 info.capture_time_ms = 0; |
| 326 info.decode_finish_ms = kLongEndToEndDelay; | 326 info.decode_finish_ms = kLongEndToEndDelay; |
| 327 statistics_proxy_->OnTimingFrameInfoUpdated(info); | 327 statistics_proxy_->OnTimingFrameInfoUpdated(info); |
| 328 info.rtp_timestamp = kExpectedRtpTimestamp + 1; | 328 info.rtp_timestamp = kExpectedRtpTimestamp + 1; |
| 329 info.capture_time_ms = 0; | 329 info.capture_time_ms = 0; |
| 330 info.decode_finish_ms = kMedEndToEndDelay; | 330 info.decode_finish_ms = kMedEndToEndDelay; |
| 331 statistics_proxy_->OnTimingFrameInfoUpdated(info); | 331 statistics_proxy_->OnTimingFrameInfoUpdated(info); |
| 332 result = statistics_proxy_->GetAndResetTimingFrameInfo(); | 332 result = statistics_proxy_->GetStats().timing_frame_info; |
| 333 EXPECT_TRUE(result); | 333 EXPECT_TRUE(result); |
| 334 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); | 334 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); |
| 335 } | 335 } |
| 336 | 336 |
| 337 TEST_F(ReceiveStatisticsProxyTest, GetTimingFrameInfoTimingFramesReportedOnce) { | 337 TEST_F(ReceiveStatisticsProxyTest, RespectsReportingIntervalForTimingFrames) { |
| 338 TimingFrameInfo info; |
| 338 const int64_t kShortEndToEndDelay = 10; | 339 const int64_t kShortEndToEndDelay = 10; |
| 339 const uint32_t kExpectedRtpTimestamp = 2; | 340 const uint32_t kExpectedRtpTimestamp = 2; |
| 340 TimingFrameInfo info; | 341 const int64_t kShortDelayMs = 1000; |
| 342 const int64_t kLongDelayMs = 10000; |
| 341 rtc::Optional<TimingFrameInfo> result; | 343 rtc::Optional<TimingFrameInfo> result; |
| 342 info.rtp_timestamp = kExpectedRtpTimestamp; | 344 info.rtp_timestamp = kExpectedRtpTimestamp; |
| 343 info.capture_time_ms = 0; | 345 info.capture_time_ms = 0; |
| 344 info.decode_finish_ms = kShortEndToEndDelay; | 346 info.decode_finish_ms = kShortEndToEndDelay; |
| 345 statistics_proxy_->OnTimingFrameInfoUpdated(info); | 347 statistics_proxy_->OnTimingFrameInfoUpdated(info); |
| 346 result = statistics_proxy_->GetAndResetTimingFrameInfo(); | 348 fake_clock_.AdvanceTimeMilliseconds(kShortDelayMs); |
| 349 result = statistics_proxy_->GetStats().timing_frame_info; |
| 347 EXPECT_TRUE(result); | 350 EXPECT_TRUE(result); |
| 348 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); | 351 EXPECT_EQ(kExpectedRtpTimestamp, result->rtp_timestamp); |
| 349 result = statistics_proxy_->GetAndResetTimingFrameInfo(); | 352 fake_clock_.AdvanceTimeMilliseconds(kLongDelayMs); |
| 353 result = statistics_proxy_->GetStats().timing_frame_info; |
| 350 EXPECT_FALSE(result); | 354 EXPECT_FALSE(result); |
| 351 } | 355 } |
| 352 | 356 |
| 353 TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) { | 357 TEST_F(ReceiveStatisticsProxyTest, LifetimeHistogramIsUpdated) { |
| 354 const int64_t kTimeSec = 3; | 358 const int64_t kTimeSec = 3; |
| 355 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); | 359 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); |
| 356 // Need at least one frame to report stream lifetime. | 360 // Need at least one frame to report stream lifetime. |
| 357 statistics_proxy_->OnCompleteFrame(true, 1000, VideoContentType::UNSPECIFIED); | 361 statistics_proxy_->OnCompleteFrame(true, 1000, VideoContentType::UNSPECIFIED); |
| 358 // Histograms are updated when the statistics_proxy_ is deleted. | 362 // Histograms are updated when the statistics_proxy_ is deleted. |
| 359 statistics_proxy_.reset(); | 363 statistics_proxy_.reset(); |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 948 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
| 945 EXPECT_EQ(kInterFrameDelayMs2, | 949 EXPECT_EQ(kInterFrameDelayMs2, |
| 946 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | 950 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
| 947 EXPECT_EQ((kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2, | 951 EXPECT_EQ((kInterFrameDelayMs1 + kInterFrameDelayMs2) / 2, |
| 948 metrics::MinSample( | 952 metrics::MinSample( |
| 949 "WebRTC.Video.InterframeDelayInMs.ExperimentGroup0")); | 953 "WebRTC.Video.InterframeDelayInMs.ExperimentGroup0")); |
| 950 } | 954 } |
| 951 } | 955 } |
| 952 | 956 |
| 953 } // namespace webrtc | 957 } // namespace webrtc |
| OLD | NEW |