OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 EXPECT_EQ(1000, mon.get_bandwidth_estimation()); | 81 EXPECT_EQ(1000, mon.get_bandwidth_estimation()); |
82 EXPECT_FALSE(mon.Sample(1, kBandwidthSample)); | 82 EXPECT_FALSE(mon.Sample(1, kBandwidthSample)); |
83 EXPECT_FALSE(mon.Sample(2, kBandwidthSample)); | 83 EXPECT_FALSE(mon.Sample(2, kBandwidthSample)); |
84 EXPECT_FALSE(mon.Sample(3, kBandwidthSample)); | 84 EXPECT_FALSE(mon.Sample(3, kBandwidthSample)); |
85 EXPECT_FALSE(mon.Sample(4, kBandwidthSample)); | 85 EXPECT_FALSE(mon.Sample(4, kBandwidthSample)); |
86 EXPECT_EQ(1000, mon.get_bandwidth_estimation()); | 86 EXPECT_EQ(1000, mon.get_bandwidth_estimation()); |
87 EXPECT_TRUE(mon.Sample(5, kBandwidthSample)); | 87 EXPECT_TRUE(mon.Sample(5, kBandwidthSample)); |
88 EXPECT_EQ(kBandwidthSample, mon.get_bandwidth_estimation()); | 88 EXPECT_EQ(kBandwidthSample, mon.get_bandwidth_estimation()); |
89 } | 89 } |
90 | 90 |
91 TEST(BandwidthSmootherTest, TestSampleRollover) { | 91 // Disabled for UBSan: https://bugs.chromium.org/p/webrtc/issues/detail?id=5491 |
| 92 #ifdef UNDEFINED_SANITIZER |
| 93 #define MAYBE_TestSampleRollover DISABLED_TestSampleRollover |
| 94 #else |
| 95 #define MAYBE_TestSampleRollover TestSampleRollover |
| 96 #endif |
| 97 TEST(BandwidthSmootherTest, MAYBE_TestSampleRollover) { |
92 const int kHugeBandwidth = 2000000000; // > INT_MAX/1.1 | 98 const int kHugeBandwidth = 2000000000; // > INT_MAX/1.1 |
93 BandwidthSmoother mon(kHugeBandwidth, | 99 BandwidthSmoother mon(kHugeBandwidth, |
94 kTimeBetweenIncrease, | 100 kTimeBetweenIncrease, |
95 kPercentIncrease, | 101 kPercentIncrease, |
96 kSamplesCountToAverage, | 102 kSamplesCountToAverage, |
97 kMinSampleCountPercent); | 103 kMinSampleCountPercent); |
98 | 104 |
99 EXPECT_FALSE(mon.Sample(10, INT_MAX)); | 105 EXPECT_FALSE(mon.Sample(10, INT_MAX)); |
100 EXPECT_FALSE(mon.Sample(11, INT_MAX)); | 106 EXPECT_FALSE(mon.Sample(11, INT_MAX)); |
101 EXPECT_EQ(kHugeBandwidth, mon.get_bandwidth_estimation()); | 107 EXPECT_EQ(kHugeBandwidth, mon.get_bandwidth_estimation()); |
102 } | 108 } |
103 | 109 |
104 TEST(BandwidthSmootherTest, TestSampleNegative) { | 110 TEST(BandwidthSmootherTest, TestSampleNegative) { |
105 BandwidthSmoother mon(1000, // initial_bandwidth_guess | 111 BandwidthSmoother mon(1000, // initial_bandwidth_guess |
106 kTimeBetweenIncrease, | 112 kTimeBetweenIncrease, |
107 kPercentIncrease, | 113 kPercentIncrease, |
108 kSamplesCountToAverage, | 114 kSamplesCountToAverage, |
109 kMinSampleCountPercent); | 115 kMinSampleCountPercent); |
110 | 116 |
111 EXPECT_FALSE(mon.Sample(10, -1)); | 117 EXPECT_FALSE(mon.Sample(10, -1)); |
112 EXPECT_FALSE(mon.Sample(11, -1)); | 118 EXPECT_FALSE(mon.Sample(11, -1)); |
113 EXPECT_EQ(1000, mon.get_bandwidth_estimation()); | 119 EXPECT_EQ(1000, mon.get_bandwidth_estimation()); |
114 } | 120 } |
115 | 121 |
116 } // namespace rtc | 122 } // namespace rtc |
OLD | NEW |