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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 states.encoder->SetTargetBitrate(rate); | 173 states.encoder->SetTargetBitrate(rate); |
174 EXPECT_EQ(rate, states.encoder->GetTargetBitrate()); | 174 EXPECT_EQ(rate, states.encoder->GetTargetBitrate()); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 namespace { | 178 namespace { |
179 | 179 |
180 // Returns a vector with the n evenly-spaced numbers a, a + (b - a)/(n - 1), | 180 // Returns a vector with the n evenly-spaced numbers a, a + (b - a)/(n - 1), |
181 // ..., b. | 181 // ..., b. |
182 std::vector<double> IntervalSteps(double a, double b, size_t n) { | 182 std::vector<double> IntervalSteps(double a, double b, size_t n) { |
183 RTC_DCHECK_GT(n, 1u); | 183 RTC_DCHECK_GT(n, 1); |
184 const double step = (b - a) / (n - 1); | 184 const double step = (b - a) / (n - 1); |
185 std::vector<double> points; | 185 std::vector<double> points; |
186 for (size_t i = 0; i < n; ++i) | 186 for (size_t i = 0; i < n; ++i) |
187 points.push_back(a + i * step); | 187 points.push_back(a + i * step); |
188 return points; | 188 return points; |
189 } | 189 } |
190 | 190 |
191 // Sets the packet loss rate to each number in the vector in turn, and verifies | 191 // Sets the packet loss rate to each number in the vector in turn, and verifies |
192 // that the loss rate as reported by the encoder is |expected_return| for all | 192 // that the loss rate as reported by the encoder is |expected_return| for all |
193 // of them. | 193 // of them. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 states.encoder->OnReceivedUplinkPacketLossFraction(kPacketLossFraction_2); | 329 states.encoder->OnReceivedUplinkPacketLossFraction(kPacketLossFraction_2); |
330 | 330 |
331 // Now the output of packet loss fraction smoother should be | 331 // Now the output of packet loss fraction smoother should be |
332 // (0.02 + 0.198) / 2 = 0.109, which reach the threshold for the optimized | 332 // (0.02 + 0.198) / 2 = 0.109, which reach the threshold for the optimized |
333 // packet loss rate to increase to 0.05. If no smoothing has been made, the | 333 // packet loss rate to increase to 0.05. If no smoothing has been made, the |
334 // optimized packet loss rate should have been increase to 0.1. | 334 // optimized packet loss rate should have been increase to 0.1. |
335 EXPECT_DOUBLE_EQ(0.05, states.encoder->packet_loss_rate()); | 335 EXPECT_DOUBLE_EQ(0.05, states.encoder->packet_loss_rate()); |
336 } | 336 } |
337 | 337 |
338 } // namespace webrtc | 338 } // namespace webrtc |
OLD | NEW |