OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 tracker->OnPacketFeedbackVector(packet_feedback_vector); | 89 tracker->OnPacketFeedbackVector(packet_feedback_vector); |
90 tracker->Validate(); | 90 tracker->Validate(); |
91 } | 91 } |
92 | 92 |
93 // Checks that validty is as expected. If valid, checks also that | 93 // Checks that validty is as expected. If valid, checks also that |
94 // value is as expected. | 94 // value is as expected. |
95 void ValidatePacketLossStatistics( | 95 void ValidatePacketLossStatistics( |
96 const TransportFeedbackPacketLossTracker& tracker, | 96 const TransportFeedbackPacketLossTracker& tracker, |
97 rtc::Optional<float> expected_plr, | 97 rtc::Optional<float> expected_plr, |
98 rtc::Optional<float> expected_rplr) { | 98 rtc::Optional<float> expected_rplr) { |
99 // TODO(elad.alon): Comparing the rtc::Optional<float> directly would have | 99 // TODO(eladalon): Comparing the rtc::Optional<float> directly would have |
100 // given concise code, but less readable error messages. If we modify | 100 // given concise code, but less readable error messages. If we modify |
101 // the way rtc::Optional is printed, we can get rid of this. | 101 // the way rtc::Optional is printed, we can get rid of this. |
102 rtc::Optional<float> plr = tracker.GetPacketLossRate(); | 102 rtc::Optional<float> plr = tracker.GetPacketLossRate(); |
103 EXPECT_EQ(static_cast<bool>(expected_plr), static_cast<bool>(plr)); | 103 EXPECT_EQ(static_cast<bool>(expected_plr), static_cast<bool>(plr)); |
104 if (expected_plr && plr) { | 104 if (expected_plr && plr) { |
105 EXPECT_EQ(*expected_plr, *plr); | 105 EXPECT_EQ(*expected_plr, *plr); |
106 } | 106 } |
107 | 107 |
108 rtc::Optional<float> rplr = tracker.GetRecoverablePacketLossRate(); | 108 rtc::Optional<float> rplr = tracker.GetRecoverablePacketLossRate(); |
109 EXPECT_EQ(static_cast<bool>(expected_rplr), static_cast<bool>(rplr)); | 109 EXPECT_EQ(static_cast<bool>(expected_rplr), static_cast<bool>(rplr)); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 591 |
592 // All tests are run multiple times with various baseline sequence number, | 592 // All tests are run multiple times with various baseline sequence number, |
593 // to weed out potential bugs with wrap-around handling. | 593 // to weed out potential bugs with wrap-around handling. |
594 constexpr uint16_t kBases[] = {0x0000, 0x3456, 0xc032, 0xfffe}; | 594 constexpr uint16_t kBases[] = {0x0000, 0x3456, 0xc032, 0xfffe}; |
595 | 595 |
596 INSTANTIATE_TEST_CASE_P(_, | 596 INSTANTIATE_TEST_CASE_P(_, |
597 TransportFeedbackPacketLossTrackerTest, | 597 TransportFeedbackPacketLossTrackerTest, |
598 testing::ValuesIn(kBases)); | 598 testing::ValuesIn(kBases)); |
599 | 599 |
600 } // namespace webrtc | 600 } // namespace webrtc |
OLD | NEW |