| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 encoder_->SetTargetBitrate(rate); | 97 encoder_->SetTargetBitrate(rate); |
| 98 EXPECT_EQ(rate, encoder_->GetTargetBitrate()); | 98 EXPECT_EQ(rate, encoder_->GetTargetBitrate()); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 namespace { | 102 namespace { |
| 103 | 103 |
| 104 // Returns a vector with the n evenly-spaced numbers a, a + (b - a)/(n - 1), | 104 // Returns a vector with the n evenly-spaced numbers a, a + (b - a)/(n - 1), |
| 105 // ..., b. | 105 // ..., b. |
| 106 std::vector<double> IntervalSteps(double a, double b, size_t n) { | 106 std::vector<double> IntervalSteps(double a, double b, size_t n) { |
| 107 DCHECK_GT(n, 1u); | 107 RTC_DCHECK_GT(n, 1u); |
| 108 const double step = (b - a) / (n - 1); | 108 const double step = (b - a) / (n - 1); |
| 109 std::vector<double> points; | 109 std::vector<double> points; |
| 110 for (size_t i = 0; i < n; ++i) | 110 for (size_t i = 0; i < n; ++i) |
| 111 points.push_back(a + i * step); | 111 points.push_back(a + i * step); |
| 112 return points; | 112 return points; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Sets the packet loss rate to each number in the vector in turn, and verifies | 115 // Sets the packet loss rate to each number in the vector in turn, and verifies |
| 116 // that the loss rate as reported by the encoder is |expected_return| for all | 116 // that the loss rate as reported by the encoder is |expected_return| for all |
| 117 // of them. | 117 // of them. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 142 | 142 |
| 143 TestSetPacketLossRate(encoder_.get(), I(1.00 , 0.18 + eps), 0.20); | 143 TestSetPacketLossRate(encoder_.get(), I(1.00 , 0.18 + eps), 0.20); |
| 144 TestSetPacketLossRate(encoder_.get(), I(0.18 - eps, 0.09 + eps), 0.10); | 144 TestSetPacketLossRate(encoder_.get(), I(0.18 - eps, 0.09 + eps), 0.10); |
| 145 TestSetPacketLossRate(encoder_.get(), I(0.09 - eps, 0.04 + eps), 0.05); | 145 TestSetPacketLossRate(encoder_.get(), I(0.09 - eps, 0.04 + eps), 0.05); |
| 146 TestSetPacketLossRate(encoder_.get(), I(0.04 - eps, 0.01 + eps), 0.01); | 146 TestSetPacketLossRate(encoder_.get(), I(0.04 - eps, 0.01 + eps), 0.01); |
| 147 TestSetPacketLossRate(encoder_.get(), I(0.01 - eps, 0.00 ), 0.00); | 147 TestSetPacketLossRate(encoder_.get(), I(0.01 - eps, 0.00 ), 0.00); |
| 148 // clang-format on | 148 // clang-format on |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace webrtc | 151 } // namespace webrtc |
| OLD | NEW |