| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 24 matching lines...) Expand all Loading... |
| 35 : now_ms_(0), | 35 : now_ms_(0), |
| 36 receive_time_ms_(0), | 36 receive_time_ms_(0), |
| 37 rtp_timestamp_(10 * 90), | 37 rtp_timestamp_(10 * 90), |
| 38 overuse_detector_(), | 38 overuse_detector_(), |
| 39 overuse_estimator_(new OveruseEstimator(options_)), | 39 overuse_estimator_(new OveruseEstimator(options_)), |
| 40 inter_arrival_(new InterArrival(5 * 90, kRtpTimestampToMs, true)), | 40 inter_arrival_(new InterArrival(5 * 90, kRtpTimestampToMs, true)), |
| 41 random_(123456789) {} | 41 random_(123456789) {} |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 void SetUp() override { | 44 void SetUp() override { |
| 45 overuse_detector_.reset(new OveruseDetector(options_)); | 45 overuse_detector_.reset(new OveruseDetector()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 int Run100000Samples(int packets_per_frame, size_t packet_size, int mean_ms, | 48 int Run100000Samples(int packets_per_frame, size_t packet_size, int mean_ms, |
| 49 int standard_deviation_ms) { | 49 int standard_deviation_ms) { |
| 50 int unique_overuse = 0; | 50 int unique_overuse = 0; |
| 51 int last_overuse = -1; | 51 int last_overuse = -1; |
| 52 for (int i = 0; i < 100000; ++i) { | 52 for (int i = 0; i < 100000; ++i) { |
| 53 for (int j = 0; j < packets_per_frame; ++j) { | 53 for (int j = 0; j < packets_per_frame; ++j) { |
| 54 UpdateDetector(rtp_timestamp_, receive_time_ms_, packet_size); | 54 UpdateDetector(rtp_timestamp_, receive_time_ms_, packet_size); |
| 55 } | 55 } |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 642 } |
| 643 | 643 |
| 644 class OveruseDetectorExperimentTest : public OveruseDetectorTest { | 644 class OveruseDetectorExperimentTest : public OveruseDetectorTest { |
| 645 public: | 645 public: |
| 646 OveruseDetectorExperimentTest() | 646 OveruseDetectorExperimentTest() |
| 647 : override_field_trials_( | 647 : override_field_trials_( |
| 648 "WebRTC-AdaptiveBweThreshold/Enabled-0.01,0.00018/") {} | 648 "WebRTC-AdaptiveBweThreshold/Enabled-0.01,0.00018/") {} |
| 649 | 649 |
| 650 protected: | 650 protected: |
| 651 void SetUp() override { | 651 void SetUp() override { |
| 652 overuse_detector_.reset(new OveruseDetector(options_)); | 652 overuse_detector_.reset(new OveruseDetector()); |
| 653 } | 653 } |
| 654 | 654 |
| 655 test::ScopedFieldTrials override_field_trials_; | 655 test::ScopedFieldTrials override_field_trials_; |
| 656 }; | 656 }; |
| 657 | 657 |
| 658 TEST_F(OveruseDetectorExperimentTest, ThresholdAdapts) { | 658 TEST_F(OveruseDetectorExperimentTest, ThresholdAdapts) { |
| 659 const double kOffset = 0.21; | 659 const double kOffset = 0.21; |
| 660 double kTsDelta = 3000.0; | 660 double kTsDelta = 3000.0; |
| 661 int64_t now_ms = 0; | 661 int64_t now_ms = 0; |
| 662 int num_deltas = 60; | 662 int num_deltas = 60; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 if (overuse_state == kBwOverusing) { | 770 if (overuse_state == kBwOverusing) { |
| 771 overuse_detected = true; | 771 overuse_detected = true; |
| 772 } | 772 } |
| 773 ++num_deltas; | 773 ++num_deltas; |
| 774 now_ms += 5; | 774 now_ms += 5; |
| 775 } | 775 } |
| 776 EXPECT_TRUE(overuse_detected); | 776 EXPECT_TRUE(overuse_detected); |
| 777 } | 777 } |
| 778 } // namespace testing | 778 } // namespace testing |
| 779 } // namespace webrtc | 779 } // namespace webrtc |
| OLD | NEW |