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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 const MediaPacket media_packet3(0, 0, 0, 0); | 550 const MediaPacket media_packet3(0, 0, 0, 0); |
551 const MediaPacket media_packet4(0, 0, 0, 0x8000); | 551 const MediaPacket media_packet4(0, 0, 0, 0x8000); |
552 // Only these two packets will be considered. | 552 // Only these two packets will be considered. |
553 nada_receiver_.ReceivePacket(2 * kTimeWindowMs, media_packet3); | 553 nada_receiver_.ReceivePacket(2 * kTimeWindowMs, media_packet3); |
554 nada_receiver_.ReceivePacket(2 * kTimeWindowMs, media_packet4); | 554 nada_receiver_.ReceivePacket(2 * kTimeWindowMs, media_packet4); |
555 EXPECT_NEAR(nada_receiver_.RecentPacketLossRatio(), 0.99994f, 0.00001f); | 555 EXPECT_NEAR(nada_receiver_.RecentPacketLossRatio(), 0.99994f, 0.00001f); |
556 } | 556 } |
557 | 557 |
558 // Packets arriving unordered should not be counted as losted. | 558 // Packets arriving unordered should not be counted as losted. |
559 TEST_F(NadaReceiverSideTest, PacketLossUnorderedPackets) { | 559 TEST_F(NadaReceiverSideTest, PacketLossUnorderedPackets) { |
560 int num_packets = nada_receiver_.GetSetCapacity() / 2; | 560 size_t num_packets = nada_receiver_.GetSetCapacity() / 2; |
561 std::vector<uint16_t> sequence_numbers; | 561 std::vector<uint16_t> sequence_numbers; |
562 | 562 |
563 for (int i = 0; i < num_packets; ++i) { | 563 for (size_t i = 0; i < num_packets; ++i) { |
564 sequence_numbers.push_back(static_cast<uint16_t>(i + 1)); | 564 sequence_numbers.push_back(static_cast<uint16_t>(i + 1)); |
565 } | 565 } |
566 | 566 |
567 random_shuffle(sequence_numbers.begin(), sequence_numbers.end()); | 567 random_shuffle(sequence_numbers.begin(), sequence_numbers.end()); |
568 | 568 |
569 for (int i = 0; i < num_packets; ++i) { | 569 for (size_t i = 0; i < num_packets; ++i) { |
570 const MediaPacket media_packet(kFlowId, 0, 0, sequence_numbers[i]); | 570 const MediaPacket media_packet(kFlowId, 0, 0, sequence_numbers[i]); |
571 // Arrival time = 0, all packets will be considered. | 571 // Arrival time = 0, all packets will be considered. |
572 nada_receiver_.ReceivePacket(0, media_packet); | 572 nada_receiver_.ReceivePacket(0, media_packet); |
573 } | 573 } |
574 | 574 |
575 EXPECT_EQ(nada_receiver_.RecentPacketLossRatio(), 0.0f); | 575 EXPECT_EQ(nada_receiver_.RecentPacketLossRatio(), 0.0f); |
576 } | 576 } |
577 | 577 |
578 TEST_F(FilterTest, MedianConstantArray) { | 578 TEST_F(FilterTest, MedianConstantArray) { |
579 MedianFilterConstantArray(); | 579 MedianFilterConstantArray(); |
(...skipping 22 matching lines...) Expand all Loading... |
602 for (int i = 1; i < kNumElements; ++i) { | 602 for (int i = 1; i < kNumElements; ++i) { |
603 EXPECT_EQ( | 603 EXPECT_EQ( |
604 exp_smoothed[i], | 604 exp_smoothed[i], |
605 static_cast<int64_t>(exp_smoothed[i - 1] * (1.0f - kAlpha) + 0.5f)); | 605 static_cast<int64_t>(exp_smoothed[i - 1] * (1.0f - kAlpha) + 0.5f)); |
606 } | 606 } |
607 } | 607 } |
608 | 608 |
609 } // namespace bwe | 609 } // namespace bwe |
610 } // namespace testing | 610 } // namespace testing |
611 } // namespace webrtc | 611 } // namespace webrtc |
OLD | NEW |