Index: webrtc/voice_engine/transport_feedback_packet_loss_tracker_unittest.cc |
diff --git a/webrtc/voice_engine/transport_feedback_packet_loss_tracker_unittest.cc b/webrtc/voice_engine/transport_feedback_packet_loss_tracker_unittest.cc |
index f639923b8c836f7b4f72a57131c8de393f21fb84..eb229a09d2a5b2068a9579b7ee4811d9c2510925 100644 |
--- a/webrtc/voice_engine/transport_feedback_packet_loss_tracker_unittest.cc |
+++ b/webrtc/voice_engine/transport_feedback_packet_loss_tracker_unittest.cc |
@@ -46,175 +46,216 @@ void AddTransportFeedbackAndValidate( |
test_feedback.AddReceivedPacket(sequence_num, kBaseTimeUs); |
++sequence_num; |
} |
+ |
+ // TransportFeedback imposes some limitations on what constitutes a legal |
+ // status vector. For instance, the vector cannot terminate in a lost |
+ // packet. Make sure all limitations are abided by. |
+ RTC_CHECK_EQ(base_sequence_num, test_feedback.GetBaseSequence()); |
+ const auto& vec = test_feedback.GetStatusVector(); |
+ RTC_CHECK_EQ(reception_status_vec.size(), vec.size()); |
+ for (size_t i = 0; i < reception_status_vec.size(); i++) { |
+ RTC_CHECK_EQ(reception_status_vec[i], |
+ vec[i] != TransportFeedback::StatusSymbol::kNotReceived); |
+ } |
+ |
tracker->OnReceivedTransportFeedback(test_feedback); |
tracker->Validate(); |
} |
+// Checks that validty is as expected. If valid, checks also that |
+// value is as expected. |
+void ValidatePacketLossStatistics( |
+ const TransportFeedbackPacketLossTracker& tracker, |
+ rtc::Optional<float> expected_plr, |
+ rtc::Optional<float> expected_rplr) { |
+ // Comparing the rtc::Optional<float> directly would have given concise code, |
+ // but less readable error messages. |
+ rtc::Optional<float> plr = tracker.GetPacketLossRate(); |
+ EXPECT_EQ(static_cast<bool>(expected_plr), static_cast<bool>(plr)); |
+ if (expected_plr && plr) { |
+ EXPECT_EQ(*expected_plr, *plr); |
+ } |
+ |
+ rtc::Optional<float> rplr = tracker.GetRecoverablePacketLossRate(); |
+ EXPECT_EQ(static_cast<bool>(expected_rplr), static_cast<bool>(rplr)); |
+ if (expected_rplr && rplr) { |
+ EXPECT_EQ(*expected_rplr, *rplr); |
+ } |
+} |
+ |
+// Convenience function for when both are valid, and explicitly stating |
+// the rtc::Optional<float> constructor is just cumbersome. |
+void ValidatePacketLossStatistics( |
+ const TransportFeedbackPacketLossTracker& tracker, |
+ float expected_plr, |
+ float expected_rplr) { |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(expected_plr), |
+ rtc::Optional<float>(expected_rplr)); |
+} |
+ |
} // namespace |
// Sanity check on an empty window. |
TEST(TransportFeedbackPacketLossTrackerTest, EmptyWindow) { |
std::unique_ptr<TransportFeedback> feedback; |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 5); |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
- |
- // PLR and CPLR reported as unknown before reception of first feedback. |
- EXPECT_FALSE(tracker.GetPacketLossRates(&plr, &cplr)); |
+ // PLR and RPLR reported as unknown before reception of first feedback. |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(), |
+ rtc::Optional<float>()); |
} |
// Sanity check on partially filled window. |
-TEST(TransportFeedbackPacketLossTrackerTest, PartiallyFilledWindow) { |
+TEST(TransportFeedbackPacketLossTrackerTest, PlrPartiallyFilledWindow) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 4); |
- // PLR and CPLR reported as unknown before minimum window size reached. |
+ // PLR unknown before minimum window size reached. |
+ // RPLR unknown before minimum pairs reached. |
// Expected window contents: [] -> [1001]. |
AddTransportFeedbackAndValidate(&tracker, base, {true, false, false, true}); |
- EXPECT_FALSE(tracker.GetPacketLossRates(&plr, &cplr)); |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(), |
+ rtc::Optional<float>()); |
} |
} |
-// Sanity check on minimum filled window. |
-TEST(TransportFeedbackPacketLossTrackerTest, MinimumFilledWindow) { |
+// Sanity check on minimum filled window - PLR known, RPLR unknown. |
+TEST(TransportFeedbackPacketLossTrackerTest, PlrMinimumFilledWindow) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 5); |
- // PLR and CPLR correctly calculated after minimum window size reached. |
+ // PLR correctly calculated after minimum window size reached. |
+ // RPLR not necessarily known at that time (not if min-pairs not reached). |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(2.0f / 5.0f), |
+ rtc::Optional<float>()); |
} |
} |
-// Additional reports update PLR and CPLR. |
+// Sanity check on minimum filled window - PLR unknown, RPLR known. |
+TEST(TransportFeedbackPacketLossTrackerTest, RplrMinimumFilledWindow) { |
+ for (uint16_t base : kBases) { |
+ TransportFeedbackPacketLossTracker tracker(10, 6, 4); |
+ |
+ // RPLR correctly calculated after minimum pairs reached. |
+ // PLR not necessarily known at that time (not if min window not reached). |
+ // Expected window contents: [] -> [10011]. |
+ AddTransportFeedbackAndValidate(&tracker, base, |
+ {true, false, false, true, true}); |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(), |
+ rtc::Optional<float>(1.0f / 4.0f)); |
+ } |
+} |
+ |
+// Additional reports update PLR and RPLR. |
TEST(TransportFeedbackPacketLossTrackerTest, ExtendWindow) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 5); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(2.0f / 5.0f), |
+ rtc::Optional<float>()); |
- // Expected window contents: [10011] -> [10011-10101]. |
+ // Expected window contents: [10011] -> [1001110101]. |
AddTransportFeedbackAndValidate(&tracker, base + 5, |
{true, false, true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 4.0f / 10.0f, 3.0f / 9.0f); |
- // Expected window contents: [10011-10101] -> [10011-10101-10001]. |
- AddTransportFeedbackAndValidate(&tracker, base + 10, |
+ // Expected window contents: [1001110101] -> [1001110101-GAP-10001]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 20, |
{true, false, false, false, true}); |
- |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 7.0f / 15.0f); |
- EXPECT_EQ(cplr, 3.0f / 15.0f); |
+ ValidatePacketLossStatistics(tracker, 7.0f / 15.0f, 4.0f / 13.0f); |
} |
} |
+// All packets correctly received. |
TEST(TransportFeedbackPacketLossTrackerTest, AllReceived) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 4); |
- // PLR and CPLR correctly calculated after minimum window size reached. |
+ // PLR and RPLR correctly calculated after minimum window size reached. |
// Expected window contents: [] -> [11111]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, true, true, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 0.0f); |
- EXPECT_EQ(cplr, 0.0f); |
+ ValidatePacketLossStatistics(tracker, 0.0f, 0.0f); |
} |
} |
// Repeated reports are ignored. |
TEST(TransportFeedbackPacketLossTrackerTest, ReportRepetition) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 4); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
// Repeat entire previous feedback |
// Expected window contents: [10011] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
} |
} |
// Report overlap. |
TEST(TransportFeedbackPacketLossTrackerTest, ReportOverlap) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
- // Expected window contents: [10011] -> [10011-01]. |
+ // Expected window contents: [10011] -> [1001101]. |
AddTransportFeedbackAndValidate(&tracker, base + 3, |
{true, true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 3.0f / 7.0f); |
- EXPECT_EQ(cplr, 1.0f / 7.0f); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 7.0f, 2.0f / 6.0f); |
} |
} |
// Report conflict. |
TEST(TransportFeedbackPacketLossTrackerTest, ReportConflict) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 4); |
// Expected window contents: [] -> [01001]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{false, true, false, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 5.0f, 2.0f / 4.0f); |
// Expected window contents: [01001] -> [11101]. |
// While false->true will be applied, true -> false will be ignored. |
AddTransportFeedbackAndValidate(&tracker, base, {true, false, true}); |
- |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 1.0f / 5.0f); |
- EXPECT_EQ(cplr, 0.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 1.0f / 5.0f, 1.0f / 4.0f); |
} |
} |
// Skipped packets treated as unknown (not lost). |
TEST(TransportFeedbackPacketLossTrackerTest, SkippedPackets) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
- // Expected window contents: [10011] -> [10011-101]. |
+ // Expected window contents: [10011] -> [10011-GAP-101]. |
AddTransportFeedbackAndValidate(&tracker, base + 100, {true, false, true}); |
- |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 3.0f / 8.0f); |
- EXPECT_EQ(cplr, 1.0f / 8.0f); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 8.0f, 2.0f / 6.0f); |
} |
} |
@@ -222,237 +263,221 @@ TEST(TransportFeedbackPacketLossTrackerTest, SkippedPackets) { |
// starts discarding after that. |
TEST(TransportFeedbackPacketLossTrackerTest, MaxWindowSize) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(10, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 10, 1); |
- // Expected window contents: [] -> [10101-00001]. |
+ // Up to max-window-size retained. |
+ // Expected window contents: [] -> [1010100001]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, true, false, true, false, false, false, false, true}); |
+ ValidatePacketLossStatistics(tracker, 6.0f / 10.0f, 3.0f / 9.0f); |
- // Up to max-window-size retained. |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 6.0f / 10.0f); |
- EXPECT_EQ(cplr, 3.0f / 10.0f); |
- |
- // Expected window contents: [10101-00001] -> [00001-10111]. |
+ // After max-window-size, older entries discarded to accommodate newer ones. |
+ // Expected window contents: [1010100001] -> [0000110111]. |
AddTransportFeedbackAndValidate(&tracker, base + 10, |
{true, false, true, true, true}); |
- |
- // After max-window-size, older entries discarded to accommodate newer ones. |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 5.0f / 10.0f); |
- EXPECT_EQ(cplr, 3.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 5.0f / 10.0f, 2.0f / 9.0f); |
} |
} |
// Inserting into the middle of a full window works correctly. |
TEST(TransportFeedbackPacketLossTrackerTest, InsertIntoMiddle) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(10, 10); |
+ TransportFeedbackPacketLossTracker tracker(10, 5, 1); |
// Expected window contents: [] -> [10101]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 2.0f / 4.0f); |
- // Expected window contents: [10101] -> [10101-10001]. |
+ // Expected window contents: [10101] -> [10101-GAP-10001]. |
AddTransportFeedbackAndValidate(&tracker, base + 100, |
{true, false, false, false, true}); |
- |
- // Setup sanity |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 5.0f / 10.0f); |
- EXPECT_EQ(cplr, 2.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 5.0f / 10.0f, 3.0f / 8.0f); |
// Insert into the middle of this full window - it discards the older data. |
- // Expected window contents: [10101-10001] -> [11111-10001]. |
+ // Expected window contents: [10101-GAP-10001] -> [11111-GAP-10001]. |
AddTransportFeedbackAndValidate(&tracker, base + 50, |
{true, true, true, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 3.0f / 10.0f); |
- EXPECT_EQ(cplr, 2.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 10.0f, 1.0f / 8.0f); |
} |
} |
-// Test the behavior of TransportFeedbackPacketLossTracker when there is a gap |
-// of more than 0x4000 in sequence number, i.e., 1/4 of total sequence numbers. |
-// Since the sequence number is used in a circular manner, i.e., after 0xffff, |
-// the sequence number wraps back to 0x0000, we refer to 1/4 of total sequence |
-// numbers as a quadrant. In this test, e.g., three transport feedbacks are |
-// added, whereas the 2nd and 3rd lie in the second quadrant w.r.t. the 1st |
-// feedback. |
+// Inserting into the middle of a full window works correctly. |
+TEST(TransportFeedbackPacketLossTrackerTest, InsertionCompletesTwoPairs) { |
+ for (uint16_t base : kBases) { |
+ TransportFeedbackPacketLossTracker tracker(15, 5, 1); |
+ |
+ // Expected window contents: [] -> [10111]. |
+ AddTransportFeedbackAndValidate(&tracker, base, |
+ {true, false, true, true, true}); |
+ ValidatePacketLossStatistics(tracker, 1.0f / 5.0f, 1.0f / 4.0f); |
+ |
+ // Expected window contents: [10111] -> [10111-GAP-10101]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 7, |
+ {true, false, true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 10.0f, 3.0f / 8.0f); |
+ |
+ // Insert in between, closing the gap completely. |
+ // Expected window contents: [10111-GAP-10101] -> [101111010101]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 5, {false, true}); |
+ ValidatePacketLossStatistics(tracker, 4.0f / 12.0f, 4.0f / 11.0f); |
+ } |
+} |
+ |
+// Entries in the second quadrant treated like those in the first. |
+// The sequence number is used in a looped manner. 0xFFFF is followed by 0x0000. |
+// In many tests, we divide the circle of sequence number into 4 quadrants, and |
+// verify the behavior of TransportFeedbackPacketLossTracker over them. |
TEST(TransportFeedbackPacketLossTrackerTest, SecondQuadrant) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
// Window *does* get updated with inputs from quadrant #2. |
- // Expected window contents: [10011] -> [10011-1]. |
+ // Expected window contents: [10011] -> [100111]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x4321, {true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 6.0f); |
- EXPECT_EQ(cplr, 1.0f / 6.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 6.0f, 1.0f / 4.0f); |
// Correct recognition of quadrant #2: up to, but not including, base + |
// 0x8000 |
- // Expected window contents: [10011-1] -> [10011-11]. |
+ // Expected window contents: [100111] -> [1001111]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x7fff, {true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 7.0f); |
- EXPECT_EQ(cplr, 1.0f / 7.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 7.0f, 1.0f / 4.0f); |
} |
} |
// Insertion into the third quadrant moves the base of the window. |
TEST(TransportFeedbackPacketLossTrackerTest, ThirdQuadrantMovesBase) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Seed the test. |
- // Expected window contents: [] -> [10011-01]. |
+ // Expected window contents: [] -> [1001101]. |
AddTransportFeedbackAndValidate( |
&tracker, base, {true, false, false, true, true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 7.0f, 2.0f / 6.0f); |
// Quadrant #3 begins at base + 0x8000. It triggers moving the window so |
// that |
// at least one (oldest) report shifts out of window. |
- // Expected window contents: [10011-01] -> [10110-01]. |
+ // Expected window contents: [1001101] -> [101-GAP-1001]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8000, |
{true, false, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 3.0f / 7.0f); |
- EXPECT_EQ(cplr, 1.0f / 7.0f); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 7.0f, 2.0f / 5.0f); |
// The base can move more than once, because the minimum quadrant-1 packets |
// were dropped out of the window, and some remain. |
+ // Expected window contents: [101-GAP-1001] -> [1-GAP-100111]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8000 + 4, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 7.0f); |
- EXPECT_EQ(cplr, 1.0f / 7.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 7.0f, 1.0f / 5.0f); |
} |
} |
// After the base has moved due to insertion into the third quadrant, it is |
// still possible to insert into the middle of the window and obtain the correct |
-// PLR and CPLR. Insertion into the middle before the max window size has been |
+// PLR and RPLR. Insertion into the middle before the max window size has been |
// achieved does not cause older packets to be dropped. |
TEST(TransportFeedbackPacketLossTrackerTest, InsertIntoMiddleAfterBaseMove) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Seed the test. |
- // Expected window contents: [] -> [10011-01]. |
+ // Expected window contents: [] -> [1001101]. |
AddTransportFeedbackAndValidate( |
&tracker, base, {true, false, false, true, true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 7.0f, 2.0f / 6.0f); |
- // Expected window contents: [10011-01] -> [10110-01]. |
+ // Expected window contents: [1001101] -> [101-GAP-1001]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8000, |
{true, false, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 7.0f, 2.0f / 5.0f); |
// Inserting into the middle still works after the base has shifted. |
- // Expected window contents: [10110-01] -> [10110-01011-001]. |
+ // Expected window contents: |
+ // [101-GAP-1001] -> [101-GAP-100101-GAP-1001] |
AddTransportFeedbackAndValidate(&tracker, base + 0x5000, |
{true, false, false, true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 6.0f / 13.0f); |
- EXPECT_EQ(cplr, 2.0f / 13.0f); |
+ ValidatePacketLossStatistics(tracker, 6.0f / 13.0f, 4.0f / 10.0f); |
// The base can keep moving after inserting into the middle. |
- // Expected window contents: [10110-01011-001] -> [11001-01100-111]. |
+ // Expected window contents: |
+ // [101-GAP-100101-GAP-1001] -> [1-GAP-100101-GAP-100111]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8000 + 4, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 5.0f / 13.0f); |
- EXPECT_EQ(cplr, 2.0f / 13.0f); |
+ ValidatePacketLossStatistics(tracker, 5.0f / 13.0f, 3.0f / 10.0f); |
} |
} |
// After moving the base of the window, the max window size is still observed. |
TEST(TransportFeedbackPacketLossTrackerTest, ThirdQuadrantObservesMaxWindow) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(10, 15); |
+ TransportFeedbackPacketLossTracker tracker(15, 10, 1); |
- // Expected window contents: [] -> [10011-10101]. |
+ // Expected window contents: [] -> [1001110101]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, false, true, true, true, false, true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 4.0f / 10.0f, 3.0f / 9.0f); |
- // Expected window contents: [10011-10101] -> [11101-01101]. |
+ // Expected window contents: [1001110101] -> [1110101-GAP-101]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8000, |
{true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 10.0f, 3.0f / 8.0f); |
// Push into middle until max window is reached. |
- // Expected window contents: [11101-01101] -> [11101-01100-01101]. |
+ // Expected window contents: |
+ // [1110101-GAP-101] -> [1110101-GAP-10001-GAP-101] |
AddTransportFeedbackAndValidate(&tracker, base + 0x4000, |
{true, false, false, false, true}); |
- |
- // Setup sanity |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 6.0f / 15.0f); |
- EXPECT_EQ(cplr, 2.0f / 15.0f); |
+ ValidatePacketLossStatistics(tracker, 6.0f / 15.0f, 4.0f / 12.0f); |
// Pushing new packets into the middle would discard older packets. |
- // Expected window contents: [11101-01100-01101] -> [01011-00011-01101]. |
+ // Expected window contents: |
+ // [1110101-GAP-10001-GAP-101] -> [0101-GAP-10001101-GAP-101] |
AddTransportFeedbackAndValidate(&tracker, base + 0x4000 + 5, |
{true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 7.0f / 15.0f); |
- EXPECT_EQ(cplr, 2.0f / 15.0f); |
+ ValidatePacketLossStatistics(tracker, 7.0f / 15.0f, 5.0f / 12.0f); |
} |
} |
// A new feedback in quadrant #3 might shift enough old feedbacks out of window, |
-// that we'd go back to an unknown PLR and CPLR. |
+// that we'd go back to an unknown PLR and RPLR. |
TEST(TransportFeedbackPacketLossTrackerTest, QuadrantThreeMovedBaseMinWindow) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
- // Expected window contents: [] -> [10011-10101]. |
+ // Expected window contents: [] -> [1001110101]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, false, true, true, true, false, true, false, true}); |
- EXPECT_TRUE( |
- tracker.GetPacketLossRates(&plr, &cplr)); // Min window reached. |
+ ValidatePacketLossStatistics(tracker, 4.0f / 10.0f, 3.0f / 9.0f); |
// A new feedback in quadrant #3 might shift enough old feedbacks out of |
- // window, that we'd go back to an unknown PLR and CPLR. This *doesn't* |
+ // window, that we'd go back to an unknown PLR and RPLR. This *doesn't* |
// necessarily mean all of the old ones were discarded, though. |
- // Expected window contents: [10011-10101] -> [0111]. |
+ // Expected window contents: [1001110101] -> [01-GAP-11]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8006, {true, true}); |
- EXPECT_FALSE(tracker.GetPacketLossRates(&plr, &cplr)); |
+ ValidatePacketLossStatistics(tracker, |
+ rtc::Optional<float>(), // Still invalid. |
+ rtc::Optional<float>(1.0f / 2.0f)); |
// Inserting in the middle shows that though some of the elements were |
// ejected, some were retained. |
- // Expected window contents: [] -> [01101-11]. |
+ // Expected window contents: [01-GAP-11] -> [01-GAP-1001-GAP-11]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x4000, |
- {true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 7.0f); |
- EXPECT_EQ(cplr, 0.0f / 7.0f); |
+ {true, false, false, true}); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 8.0f, 2.0f / 5.0f); |
} |
} |
// Quadrant four reports ignored for up to kMaxConsecutiveOldReports times. |
TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourInitiallyIgnored) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
@@ -463,9 +488,7 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourInitiallyIgnored) { |
// Expected window contents: [10011] -> [10011]. |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
} |
} |
} |
@@ -473,9 +496,7 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourInitiallyIgnored) { |
// Receiving a packet from quadrant #1 resets the counter for quadrant #4. |
TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ1) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
@@ -486,22 +507,29 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ1) { |
// Expected window contents: [10011] -> [10011]. |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
} |
// If we receive a feedback in quadrant #1, the above counter is reset. |
- // Expected window contents: [10011] -> [10011-1]. |
- AddTransportFeedbackAndValidate(&tracker, base + 0x000f, {true}); |
+ // Expected window contents: [10011] -> [100111]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 5, {true}); |
+ for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
+ // Note: though the feedback message reports three packets, it only gets |
+ // counted once. |
+ AddTransportFeedbackAndValidate(&tracker, base + 0xc000, |
+ {true, false, true}); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 6.0f, 1.0f / 5.0f); |
+ } |
+ |
+ // The same is true for reports which create a gap - they still reset. |
+ // Expected window contents: [10011] -> [100111-GAP-01]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 0x00ff, {false, true}); |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
// Note: though the feedback message reports three packets, it only gets |
// counted once. |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, |
{true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 6.0f); |
- EXPECT_EQ(cplr, 1.0f / 6.0f); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 8.0f, 2.0f / 6.0f); |
} |
} |
} |
@@ -509,9 +537,7 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ1) { |
// Receiving a packet from quadrant #2 resets the counter for quadrant #4. |
TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ2) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
@@ -522,22 +548,18 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ2) { |
// Expected window contents: [10011] -> [10011]. |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
} |
- // If we receive a feedback in quadrant #1, the above counter is reset. |
- // Expected window contents: [10011] -> [10011-1]. |
- AddTransportFeedbackAndValidate(&tracker, base + 0x400f, {true}); |
+ // If we receive a feedback in quadrant #2, the above counter is reset. |
+ // Expected window contents: [10011] -> [10011-GAP-11]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 0x400f, {true, true}); |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
// Note: though the feedback message reports three packets, it only gets |
// counted once. |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, |
{true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 6.0f); |
- EXPECT_EQ(cplr, 1.0f / 6.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 7.0f, 1.0f / 5.0f); |
} |
} |
} |
@@ -545,27 +567,23 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ2) { |
// Receiving a packet from quadrant #3 resets the counter for quadrant #4. |
TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ3) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
- // Expected window contents: [] -> [10011-10001]. |
+ // Expected window contents: [] -> [1001110001]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, false, true, true, true, false, false, false, true}); |
// Feedbacks in quadrant #4 are discarded (up to kMaxConsecutiveOldReports |
// consecutive reports). |
- // Expected window contents: [10011-10001] -> [10011-10001]. |
+ // Expected window contents: [1001110001] -> [1001110001]. |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 5.0f / 10.0f); |
- EXPECT_EQ(cplr, 3.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 5.0f / 10.0f, 2.0f / 9.0f); |
} |
// If we receive a feedback in quadrant #1, the above counter is reset. |
- // Expected window contents: [10011-10001] -> [11100-01111]. |
+ // Expected window contents: [1001110001] -> [1110001-GAP-111]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x8000, |
{true, true, true}); |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
@@ -573,9 +591,7 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ3) { |
// counted once. |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000 + 10, |
{true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 3.0f / 10.0f); |
- EXPECT_EQ(cplr, 2.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 3.0f / 10.0f, 1.0f / 8.0f); |
} |
} |
} |
@@ -584,116 +600,96 @@ TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourCounterResetByQ3) { |
// After that, the window is reset. |
TEST(TransportFeedbackPacketLossTrackerTest, QuadrantFourReset) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
- // Expected window contents: [] -> [10011-10001]. |
+ // Expected window contents: [] -> [1001110001]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, false, true, true, true, false, false, false, true}); |
+ // Sanity |
+ ValidatePacketLossStatistics(tracker, 5.0f / 10.0f, 2.0f / 9.0f); |
+ |
// The first kMaxConsecutiveOldReports quadrant #4 reports are ignored. |
// It doesn't matter that they consist of multiple packets - each report |
// is only counted once. |
for (size_t i = 0; i < kMaxConsecutiveOldReports; i++) { |
- // Expected window contents: [10011-10001] -> [10011-10001]. |
+ // Expected window contents: [1001110001] -> [1001110001]. |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, |
{true, true, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 5.0f / 10.0f); |
- EXPECT_EQ(cplr, 3.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 5.0f / 10.0f, 2.0f / 9.0f); |
} |
// One additional feedback in quadrant #4 brings us over |
// kMaxConsecutiveOldReports consecutive "old" reports, resetting the |
// window. |
+ // The new window is not completely empty - it's been seeded with the |
+ // packets reported in the feedback that has triggered the reset. |
// Note: The report doesn't have to be the same as the previous ones. |
- // Expected window contents: [10011-10001] -> [10011]. |
+ // Expected window contents: [1001110001] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base + 0xc000, |
{true, false, false, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- |
- // The new window is not completely empty - it's been seeded with the |
- // packets reported in the feedback that has triggered the reset. |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
} |
} |
// Feedbacks spanning multiple quadrant are treated correctly (Q1-Q2). |
TEST(TransportFeedbackPacketLossTrackerTest, MultiQuadrantQ1Q2) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
// Expected window contents: [] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base, |
{true, false, false, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
// A feedback with entries in both quadrant #1 and #2 gets both counted: |
- // Expected window contents: [10011] -> [10011-11]. |
- AddTransportFeedbackAndValidate(&tracker, base + 0x3fff, {true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 7.0f); |
- EXPECT_EQ(cplr, 1.0f / 7.0f); |
+ // Expected window contents: [10011] -> [10011-GAP-1001]. |
+ AddTransportFeedbackAndValidate(&tracker, base + 0x3ffe, |
+ {true, false, false, true}); |
+ ValidatePacketLossStatistics(tracker, 4.0f / 9.0f, 2.0f / 7.0f); |
} |
} |
// Feedbacks spanning multiple quadrant are treated correctly (Q2-Q3). |
TEST(TransportFeedbackPacketLossTrackerTest, MultiQuadrantQ2Q3) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
- // Expected window contents: [] -> [10011-00001]. |
+ // Expected window contents: [] -> [1001100001]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, false, true, true, false, false, false, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 6.0f / 10.0f); |
- EXPECT_EQ(cplr, 4.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 6.0f / 10.0f, 2.0f / 9.0f); |
// A feedback with entries in both quadrant #2 and #3 gets both counted, |
// but only those from #3 trigger throwing out old entries from quadrant #1: |
- // Expected window contents: [10011-00001] -> [01100-00110-01]. |
+ // Expected window contents: [1001100001] -> [01100001-GAP-1001]. |
AddTransportFeedbackAndValidate(&tracker, base + 0x7ffe, |
{true, false, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 7.0f / 12.0f); |
- EXPECT_EQ(cplr, 4.0f / 12.0f); |
+ ValidatePacketLossStatistics(tracker, 7.0f / 12.0f, 3.0f / 10.0f); |
} |
} |
-// Feedbacks spanning multiple quadrant are treated correctly (Q2-Q3). |
+// Feedbacks spanning multiple quadrant are treated correctly (Q3-Q4). |
TEST(TransportFeedbackPacketLossTrackerTest, MultiQuadrantQ3Q4) { |
for (uint16_t base : kBases) { |
- float plr = 0.0f; // Packet-loss-rate |
- float cplr = 0.0f; // Consecutive-packet-loss-rate |
- |
- TransportFeedbackPacketLossTracker tracker(5, 20); |
+ TransportFeedbackPacketLossTracker tracker(20, 5, 1); |
- // Expected window contents: [] -> [10011-00001]. |
+ // Expected window contents: [] -> [1001100001]. |
AddTransportFeedbackAndValidate( |
&tracker, base, |
{true, false, false, true, true, false, false, false, false, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 6.0f / 10.0f); |
- EXPECT_EQ(cplr, 4.0f / 10.0f); |
+ ValidatePacketLossStatistics(tracker, 6.0f / 10.0f, 2.0f / 9.0f); |
// A feedback with entries in both quadrant #3 and #4 would have the entries |
// from quadrant #3 shift enough quadrant #1 entries out of window, that |
// by the time the #4 packets are examined, the moving baseline has made |
// them into quadrant #3 packets. |
- // Expected window contents: [10011-00001] -> [10011]. |
+ // Expected window contents: [1001100001] -> [10011]. |
AddTransportFeedbackAndValidate(&tracker, base + 0xbfff, |
{true, false, false, true, true}); |
- EXPECT_TRUE(tracker.GetPacketLossRates(&plr, &cplr)); |
- EXPECT_EQ(plr, 2.0f / 5.0f); |
- EXPECT_EQ(cplr, 1.0f / 5.0f); |
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, 1.0f / 4.0f); |
} |
} |