Add a unittest to NetEq StatisticsCalculator for discarded packets counter.
Bug: webrtc:8199 Change-Id: I32127af1ae6692717f28dbf2d820cd67c0b6a66a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229300 Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Commit-Queue: Minyue Li <minyue@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34808}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
81f24c09fe
commit
1039392209
@ -179,4 +179,37 @@ TEST(StatisticsCalculator, InterruptionCounterDoNotLogBeforeDecoding) {
|
||||
EXPECT_EQ(1, lts.interruption_count);
|
||||
}
|
||||
|
||||
// Test that |discarded_primary_packets| as reported from
|
||||
// |GetOperationsAndState| always matches the arguments to |PacketsDiscarded|
|
||||
// accumulated.
|
||||
TEST(StatisticsCalculator, DiscardedPackets) {
|
||||
StatisticsCalculator statistics_calculator;
|
||||
EXPECT_EQ(
|
||||
0u,
|
||||
statistics_calculator.GetOperationsAndState().discarded_primary_packets);
|
||||
|
||||
statistics_calculator.PacketsDiscarded(1);
|
||||
EXPECT_EQ(
|
||||
1u,
|
||||
statistics_calculator.GetOperationsAndState().discarded_primary_packets);
|
||||
|
||||
statistics_calculator.PacketsDiscarded(10);
|
||||
EXPECT_EQ(
|
||||
11u,
|
||||
statistics_calculator.GetOperationsAndState().discarded_primary_packets);
|
||||
|
||||
// Calling |SecondaryPacketsDiscarded| does not modify
|
||||
// |discarded_primary_packets|.
|
||||
statistics_calculator.SecondaryPacketsDiscarded(1);
|
||||
EXPECT_EQ(
|
||||
11u,
|
||||
statistics_calculator.GetOperationsAndState().discarded_primary_packets);
|
||||
|
||||
// Calling |FlushedPacketBuffer| does not modify |discarded_primary_packets|.
|
||||
statistics_calculator.FlushedPacketBuffer();
|
||||
EXPECT_EQ(
|
||||
11u,
|
||||
statistics_calculator.GetOperationsAndState().discarded_primary_packets);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user