Remove inter-arrival delay mode from DelayManager.

Also remove the delay peak detector which is no longer used.

This should be a no-op since relative arrival delay mode is used by default.

Bug: webrtc:10333
Change-Id: Ifa326b762d52f16f9dc5f3da2874139faf1022da
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164462
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30179}
This commit is contained in:
Jakob Ivarsson
2020-01-07 17:07:40 +01:00
committed by Commit Bot
parent 57218b4e22
commit bd5874accf
14 changed files with 18 additions and 714 deletions

View File

@ -59,116 +59,6 @@ TEST(HistogramTest, ForgetFactor) {
}
}
// Test if the histogram is scaled correctly if the bucket width is decreased.
TEST(HistogramTest, DownScale) {
// Test a straightforward 60 to 20 change.
std::vector<int> buckets = {12, 0, 0, 0, 0, 0};
std::vector<int> expected_result = {4, 4, 4, 0, 0, 0};
std::vector<int> stretched_buckets = Histogram::ScaleBuckets(buckets, 60, 20);
EXPECT_EQ(stretched_buckets, expected_result);
// Test an example where the last bin in the stretched histogram should
// contain the sum of the elements that don't fit into the new histogram.
buckets = {18, 15, 12, 9, 6, 3, 0};
expected_result = {6, 6, 6, 5, 5, 5, 30};
stretched_buckets = Histogram::ScaleBuckets(buckets, 60, 20);
EXPECT_EQ(stretched_buckets, expected_result);
// Test a 120 to 60 change.
buckets = {18, 16, 14, 4, 0};
expected_result = {9, 9, 8, 8, 18};
stretched_buckets = Histogram::ScaleBuckets(buckets, 120, 60);
EXPECT_EQ(stretched_buckets, expected_result);
// Test a 120 to 20 change.
buckets = {19, 12, 0, 0, 0, 0, 0, 0};
expected_result = {3, 3, 3, 3, 3, 3, 2, 11};
stretched_buckets = Histogram::ScaleBuckets(buckets, 120, 20);
EXPECT_EQ(stretched_buckets, expected_result);
// Test a 70 to 40 change.
buckets = {13, 7, 5, 3, 1, 5, 12, 11, 3, 0, 0, 0};
expected_result = {7, 5, 5, 3, 3, 2, 2, 1, 2, 2, 6, 22};
stretched_buckets = Histogram::ScaleBuckets(buckets, 70, 40);
EXPECT_EQ(stretched_buckets, expected_result);
// Test a 30 to 20 change.
buckets = {13, 7, 5, 3, 1, 5, 12, 11, 3, 0, 0, 0};
expected_result = {8, 6, 6, 3, 2, 2, 1, 3, 3, 8, 7, 11};
stretched_buckets = Histogram::ScaleBuckets(buckets, 30, 20);
EXPECT_EQ(stretched_buckets, expected_result);
}
// Test if the histogram is scaled correctly if the bucket width is increased.
TEST(HistogramTest, UpScale) {
// Test a 20 to 60 change.
std::vector<int> buckets = {12, 11, 10, 3, 2, 1};
std::vector<int> expected_result = {33, 6, 0, 0, 0, 0};
std::vector<int> compressed_buckets =
Histogram::ScaleBuckets(buckets, 20, 60);
EXPECT_EQ(compressed_buckets, expected_result);
// Test a 60 to 120 change.
buckets = {18, 16, 14, 4, 1};
expected_result = {34, 18, 1, 0, 0};
compressed_buckets = Histogram::ScaleBuckets(buckets, 60, 120);
EXPECT_EQ(compressed_buckets, expected_result);
// Test a 20 to 120 change.
buckets = {18, 12, 5, 4, 4, 3, 5, 1};
expected_result = {46, 6, 0, 0, 0, 0, 0, 0};
compressed_buckets = Histogram::ScaleBuckets(buckets, 20, 120);
EXPECT_EQ(compressed_buckets, expected_result);
// Test a 70 to 80 change.
buckets = {13, 7, 5, 3, 1, 5, 12, 11, 3};
expected_result = {11, 8, 6, 2, 5, 12, 13, 3, 0};
compressed_buckets = Histogram::ScaleBuckets(buckets, 70, 80);
EXPECT_EQ(compressed_buckets, expected_result);
// Test a 50 to 110 change.
buckets = {13, 7, 5, 3, 1, 5, 12, 11, 3};
expected_result = {18, 8, 16, 16, 2, 0, 0, 0, 0};
compressed_buckets = Histogram::ScaleBuckets(buckets, 50, 110);
EXPECT_EQ(compressed_buckets, expected_result);
}
// Test if the histogram scaling function handles overflows correctly.
TEST(HistogramTest, OverflowTest) {
// Test a upscale operation that can cause overflow.
std::vector<int> buckets = {733544448, 0, 0, 0, 0, 0, 0,
340197376, 0, 0, 0, 0, 0, 0};
std::vector<int> expected_result = {733544448, 340197376, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0};
std::vector<int> scaled_buckets = Histogram::ScaleBuckets(buckets, 10, 60);
EXPECT_EQ(scaled_buckets, expected_result);
buckets = {655591163, 39962288, 360736736, 1930514, 4003853, 1782764,
114119, 2072996, 0, 2149354, 0};
expected_result = {1056290187, 7717131, 2187115, 2149354, 0, 0,
0, 0, 0, 0, 0};
scaled_buckets = Histogram::ScaleBuckets(buckets, 20, 60);
EXPECT_EQ(scaled_buckets, expected_result);
// In this test case we will not be able to add everything to the final bin in
// the scaled histogram. Check that the last bin doesn't overflow.
buckets = {2000000000, 2000000000, 2000000000,
2000000000, 2000000000, 2000000000};
expected_result = {666666666, 666666666, 666666666,
666666667, 666666667, 2147483647};
scaled_buckets = Histogram::ScaleBuckets(buckets, 60, 20);
EXPECT_EQ(scaled_buckets, expected_result);
// In this test case we will not be able to add enough to each of the bins,
// so the values should be smeared out past the end of the normal range.
buckets = {2000000000, 2000000000, 2000000000,
2000000000, 2000000000, 2000000000};
expected_result = {2147483647, 2147483647, 2147483647,
2147483647, 2147483647, 1262581765};
scaled_buckets = Histogram::ScaleBuckets(buckets, 20, 60);
EXPECT_EQ(scaled_buckets, expected_result);
}
TEST(HistogramTest, ReachSteadyStateForgetFactor) {
static constexpr int kSteadyStateForgetFactor = (1 << 15) * 0.9993;
Histogram histogram(100, kSteadyStateForgetFactor, 1.0);