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 |
11 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "webrtc/base/arraysize.h" |
16 | 17 |
17 namespace webrtc { | 18 namespace webrtc { |
18 namespace testing { | 19 namespace testing { |
19 namespace bwe { | 20 namespace bwe { |
20 | 21 |
21 const int kSetCapacity = 1000; | 22 const int kSetCapacity = 1000; |
22 | 23 |
23 class LinkedSetTest : public ::testing::Test { | 24 class LinkedSetTest : public ::testing::Test { |
24 public: | 25 public: |
25 LinkedSetTest() : linked_set_(kSetCapacity) {} | 26 LinkedSetTest() : linked_set_(kSetCapacity) {} |
(...skipping 208 matching lines...) Loading... |
234 | 235 |
235 for (int i = 0; i < 10; ++i) { | 236 for (int i = 0; i < 10; ++i) { |
236 const MediaPacket media_packet(kFlowId, 0, 0, 0); | 237 const MediaPacket media_packet(kFlowId, 0, 0, 0); |
237 // Arrival time = 0, all packets will be considered. | 238 // Arrival time = 0, all packets will be considered. |
238 bwe_receiver_.ReceivePacket(0, media_packet); | 239 bwe_receiver_.ReceivePacket(0, media_packet); |
239 } | 240 } |
240 EXPECT_EQ(bwe_receiver_.RecentPacketLossRatio(), 0.0f); | 241 EXPECT_EQ(bwe_receiver_.RecentPacketLossRatio(), 0.0f); |
241 | 242 |
242 // Missing the element 5. | 243 // Missing the element 5. |
243 const uint16_t kSequenceNumbers[] = {1, 2, 3, 4, 6, 7, 8}; | 244 const uint16_t kSequenceNumbers[] = {1, 2, 3, 4, 6, 7, 8}; |
244 const int kNumPackets = ARRAY_SIZE(kSequenceNumbers); | 245 const int kNumPackets = arraysize(kSequenceNumbers); |
245 | 246 |
246 // Insert each sequence number twice. | 247 // Insert each sequence number twice. |
247 for (int i = 0; i < 2; ++i) { | 248 for (int i = 0; i < 2; ++i) { |
248 for (int j = 0; j < kNumPackets; j++) { | 249 for (int j = 0; j < kNumPackets; j++) { |
249 const MediaPacket media_packet(kFlowId, 0, 0, kSequenceNumbers[j]); | 250 const MediaPacket media_packet(kFlowId, 0, 0, kSequenceNumbers[j]); |
250 // Only the packets sent in this for loop will be considered. | 251 // Only the packets sent in this for loop will be considered. |
251 bwe_receiver_.ReceivePacket(2 * kTimeWindowMs, media_packet); | 252 bwe_receiver_.ReceivePacket(2 * kTimeWindowMs, media_packet); |
252 } | 253 } |
253 } | 254 } |
254 | 255 |
(...skipping 129 matching lines...) Loading... |
384 loss_account = bwe_receiver_.LinkedSetPacketLossRatio(); | 385 loss_account = bwe_receiver_.LinkedSetPacketLossRatio(); |
385 EXPECT_NEAR(loss_account.LossRatio(), 0.0f, 0.001f); | 386 EXPECT_NEAR(loss_account.LossRatio(), 0.0f, 0.001f); |
386 | 387 |
387 // RelieveSetAndUpdateLoss automatically updates loss account. | 388 // RelieveSetAndUpdateLoss automatically updates loss account. |
388 EXPECT_NEAR(bwe_receiver_.GlobalReceiverPacketLossRatio(), 0.5f, 0.001f); | 389 EXPECT_NEAR(bwe_receiver_.GlobalReceiverPacketLossRatio(), 0.5f, 0.001f); |
389 } | 390 } |
390 | 391 |
391 } // namespace bwe | 392 } // namespace bwe |
392 } // namespace testing | 393 } // namespace testing |
393 } // namespace webrtc | 394 } // namespace webrtc |
OLD | NEW |