| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 EXPECT_EQ(InitialJitter(), CaptureJitterMs()); | 281 EXPECT_EQ(InitialJitter(), CaptureJitterMs()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 TEST_F(OveruseFrameDetectorTest, MinFrameSamplesBeforeUpdatingCaptureJitter) { | 284 TEST_F(OveruseFrameDetectorTest, MinFrameSamplesBeforeUpdatingCaptureJitter) { |
| 285 options_.min_frame_samples = 40; | 285 options_.min_frame_samples = 40; |
| 286 ReinitializeOveruseDetector(); | 286 ReinitializeOveruseDetector(); |
| 287 InsertFramesWithInterval(40, kFrameInterval33ms, kWidth, kHeight); | 287 InsertFramesWithInterval(40, kFrameInterval33ms, kWidth, kHeight); |
| 288 EXPECT_EQ(InitialJitter(), CaptureJitterMs()); | 288 EXPECT_EQ(InitialJitter(), CaptureJitterMs()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 TEST_F(OveruseFrameDetectorTest, NoCaptureQueueDelay) { | |
| 292 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 0); | |
| 293 overuse_detector_->FrameCaptured( | |
| 294 kWidth, kHeight, clock_->TimeInMilliseconds()); | |
| 295 overuse_detector_->FrameProcessingStarted(); | |
| 296 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 0); | |
| 297 } | |
| 298 | |
| 299 TEST_F(OveruseFrameDetectorTest, CaptureQueueDelay) { | |
| 300 overuse_detector_->FrameCaptured( | |
| 301 kWidth, kHeight, clock_->TimeInMilliseconds()); | |
| 302 clock_->AdvanceTimeMilliseconds(100); | |
| 303 overuse_detector_->FrameProcessingStarted(); | |
| 304 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 100); | |
| 305 } | |
| 306 | |
| 307 TEST_F(OveruseFrameDetectorTest, CaptureQueueDelayMultipleFrames) { | |
| 308 overuse_detector_->FrameCaptured( | |
| 309 kWidth, kHeight, clock_->TimeInMilliseconds()); | |
| 310 clock_->AdvanceTimeMilliseconds(10); | |
| 311 overuse_detector_->FrameCaptured( | |
| 312 kWidth, kHeight, clock_->TimeInMilliseconds()); | |
| 313 clock_->AdvanceTimeMilliseconds(20); | |
| 314 | |
| 315 overuse_detector_->FrameProcessingStarted(); | |
| 316 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 30); | |
| 317 overuse_detector_->FrameProcessingStarted(); | |
| 318 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 20); | |
| 319 } | |
| 320 | |
| 321 TEST_F(OveruseFrameDetectorTest, CaptureQueueDelayResetAtResolutionSwitch) { | |
| 322 overuse_detector_->FrameCaptured( | |
| 323 kWidth, kHeight, clock_->TimeInMilliseconds()); | |
| 324 clock_->AdvanceTimeMilliseconds(10); | |
| 325 overuse_detector_->FrameCaptured( | |
| 326 kWidth, kHeight + 1, clock_->TimeInMilliseconds()); | |
| 327 clock_->AdvanceTimeMilliseconds(20); | |
| 328 | |
| 329 overuse_detector_->FrameProcessingStarted(); | |
| 330 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 20); | |
| 331 } | |
| 332 | |
| 333 TEST_F(OveruseFrameDetectorTest, CaptureQueueDelayNoMatchingCapturedFrame) { | |
| 334 overuse_detector_->FrameCaptured( | |
| 335 kWidth, kHeight, clock_->TimeInMilliseconds()); | |
| 336 clock_->AdvanceTimeMilliseconds(100); | |
| 337 overuse_detector_->FrameProcessingStarted(); | |
| 338 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 100); | |
| 339 // No new captured frame. The last delay should be reported. | |
| 340 overuse_detector_->FrameProcessingStarted(); | |
| 341 EXPECT_EQ(overuse_detector_->CaptureQueueDelayMsPerS(), 100); | |
| 342 } | |
| 343 | |
| 344 TEST_F(OveruseFrameDetectorTest, FrameDelay_OneFrameDisabled) { | 291 TEST_F(OveruseFrameDetectorTest, FrameDelay_OneFrameDisabled) { |
| 345 options_.enable_extended_processing_usage = false; | 292 options_.enable_extended_processing_usage = false; |
| 346 ReinitializeOveruseDetector(); | 293 ReinitializeOveruseDetector(); |
| 347 const int kProcessingTimeMs = 100; | 294 const int kProcessingTimeMs = 100; |
| 348 overuse_detector_->FrameCaptured(kWidth, kHeight, 33); | 295 overuse_detector_->FrameCaptured(kWidth, kHeight, 33); |
| 349 clock_->AdvanceTimeMilliseconds(kProcessingTimeMs); | 296 clock_->AdvanceTimeMilliseconds(kProcessingTimeMs); |
| 350 overuse_detector_->FrameSent(33); | 297 overuse_detector_->FrameSent(33); |
| 351 EXPECT_EQ(-1, overuse_detector_->LastProcessingTimeMs()); | 298 EXPECT_EQ(-1, overuse_detector_->LastProcessingTimeMs()); |
| 352 } | 299 } |
| 353 | 300 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 ReinitializeOveruseDetector(); | 484 ReinitializeOveruseDetector(); |
| 538 // usage > high => overuse | 485 // usage > high => overuse |
| 539 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(0); | 486 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(0); |
| 540 TriggerOveruseWithProcessingUsage(options_.high_threshold_consecutive_count); | 487 TriggerOveruseWithProcessingUsage(options_.high_threshold_consecutive_count); |
| 541 // usage < low => underuse | 488 // usage < low => underuse |
| 542 EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0); | 489 EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0); |
| 543 TriggerUnderuseWithProcessingUsage(); | 490 TriggerUnderuseWithProcessingUsage(); |
| 544 } | 491 } |
| 545 | 492 |
| 546 } // namespace webrtc | 493 } // namespace webrtc |
| OLD | NEW |