| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 15 matching lines...) Expand all Loading... |
| 26 virtual void TearDown(); | 26 virtual void TearDown(); |
| 27 | 27 |
| 28 // Initialization of AEC handle with respect to |sample_rate_hz|. Since the | 28 // Initialization of AEC handle with respect to |sample_rate_hz|. Since the |
| 29 // device sample rate is unimportant we set that value to 48000 Hz. | 29 // device sample rate is unimportant we set that value to 48000 Hz. |
| 30 void Init(int sample_rate_hz); | 30 void Init(int sample_rate_hz); |
| 31 | 31 |
| 32 // Makes one render call and one capture call in that specific order. | 32 // Makes one render call and one capture call in that specific order. |
| 33 void RenderAndCapture(int device_buffer_ms); | 33 void RenderAndCapture(int device_buffer_ms); |
| 34 | 34 |
| 35 // Fills up the far-end buffer with respect to the default device buffer size. | 35 // Fills up the far-end buffer with respect to the default device buffer size. |
| 36 int BufferFillUp(); | 36 size_t BufferFillUp(); |
| 37 | 37 |
| 38 // Runs and verifies the behavior in a stable startup procedure. | 38 // Runs and verifies the behavior in a stable startup procedure. |
| 39 void RunStableStartup(); | 39 void RunStableStartup(); |
| 40 | 40 |
| 41 // Maps buffer size in ms into samples, taking the unprocessed frame into | 41 // Maps buffer size in ms into samples, taking the unprocessed frame into |
| 42 // account. | 42 // account. |
| 43 int MapBufferSizeToSamples(int size_in_ms, bool extended_filter); | 43 int MapBufferSizeToSamples(int size_in_ms, bool extended_filter); |
| 44 | 44 |
| 45 void* handle_; | 45 void* handle_; |
| 46 Aec* self_; | 46 Aec* self_; |
| 47 int samples_per_frame_; | 47 size_t samples_per_frame_; |
| 48 // Dummy input/output speech data. | 48 // Dummy input/output speech data. |
| 49 static const int kSamplesPerChunk = 160; | 49 static const int kSamplesPerChunk = 160; |
| 50 float far_[kSamplesPerChunk]; | 50 float far_[kSamplesPerChunk]; |
| 51 float near_[kSamplesPerChunk]; | 51 float near_[kSamplesPerChunk]; |
| 52 float out_[kSamplesPerChunk]; | 52 float out_[kSamplesPerChunk]; |
| 53 const float* near_ptr_; | 53 const float* near_ptr_; |
| 54 float* out_ptr_; | 54 float* out_ptr_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 SystemDelayTest::SystemDelayTest() | 57 SystemDelayTest::SystemDelayTest() |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // phase after |kMaxConvergenceMs| independent of device buffer stability | 95 // phase after |kMaxConvergenceMs| independent of device buffer stability |
| 96 // conditions. | 96 // conditions. |
| 97 static const int kMaxConvergenceMs = 500; | 97 static const int kMaxConvergenceMs = 500; |
| 98 | 98 |
| 99 void SystemDelayTest::Init(int sample_rate_hz) { | 99 void SystemDelayTest::Init(int sample_rate_hz) { |
| 100 // Initialize AEC | 100 // Initialize AEC |
| 101 EXPECT_EQ(0, WebRtcAec_Init(handle_, sample_rate_hz, 48000)); | 101 EXPECT_EQ(0, WebRtcAec_Init(handle_, sample_rate_hz, 48000)); |
| 102 EXPECT_EQ(0, WebRtcAec_system_delay(self_->aec)); | 102 EXPECT_EQ(0, WebRtcAec_system_delay(self_->aec)); |
| 103 | 103 |
| 104 // One frame equals 10 ms of data. | 104 // One frame equals 10 ms of data. |
| 105 samples_per_frame_ = sample_rate_hz / 100; | 105 samples_per_frame_ = static_cast<size_t>(sample_rate_hz / 100); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SystemDelayTest::RenderAndCapture(int device_buffer_ms) { | 108 void SystemDelayTest::RenderAndCapture(int device_buffer_ms) { |
| 109 EXPECT_EQ(0, WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_)); | 109 EXPECT_EQ(0, WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_)); |
| 110 EXPECT_EQ(0, | 110 EXPECT_EQ(0, |
| 111 WebRtcAec_Process(handle_, | 111 WebRtcAec_Process(handle_, |
| 112 &near_ptr_, | 112 &near_ptr_, |
| 113 1, | 113 1, |
| 114 &out_ptr_, | 114 &out_ptr_, |
| 115 samples_per_frame_, | 115 samples_per_frame_, |
| 116 device_buffer_ms, | 116 device_buffer_ms, |
| 117 0)); | 117 0)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 int SystemDelayTest::BufferFillUp() { | 120 size_t SystemDelayTest::BufferFillUp() { |
| 121 // To make sure we have a full buffer when we verify stability we first fill | 121 // To make sure we have a full buffer when we verify stability we first fill |
| 122 // up the far-end buffer with the same amount as we will report in through | 122 // up the far-end buffer with the same amount as we will report in through |
| 123 // Process(). | 123 // Process(). |
| 124 int buffer_size = 0; | 124 size_t buffer_size = 0; |
| 125 for (int i = 0; i < kDeviceBufMs / 10; i++) { | 125 for (int i = 0; i < kDeviceBufMs / 10; i++) { |
| 126 EXPECT_EQ(0, WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_)); | 126 EXPECT_EQ(0, WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_)); |
| 127 buffer_size += samples_per_frame_; | 127 buffer_size += samples_per_frame_; |
| 128 EXPECT_EQ(buffer_size, WebRtcAec_system_delay(self_->aec)); | 128 EXPECT_EQ(static_cast<int>(buffer_size), |
| 129 WebRtcAec_system_delay(self_->aec)); |
| 129 } | 130 } |
| 130 return buffer_size; | 131 return buffer_size; |
| 131 } | 132 } |
| 132 | 133 |
| 133 void SystemDelayTest::RunStableStartup() { | 134 void SystemDelayTest::RunStableStartup() { |
| 134 // To make sure we have a full buffer when we verify stability we first fill | 135 // To make sure we have a full buffer when we verify stability we first fill |
| 135 // up the far-end buffer with the same amount as we will report in through | 136 // up the far-end buffer with the same amount as we will report in through |
| 136 // Process(). | 137 // Process(). |
| 137 int buffer_size = BufferFillUp(); | 138 size_t buffer_size = BufferFillUp(); |
| 138 | 139 |
| 139 if (WebRtcAec_delay_agnostic_enabled(self_->aec) == 1) { | 140 if (WebRtcAec_delay_agnostic_enabled(self_->aec) == 1) { |
| 140 // In extended_filter mode we set the buffer size after the first processed | 141 // In extended_filter mode we set the buffer size after the first processed |
| 141 // 10 ms chunk. Hence, we don't need to wait for the reported system delay | 142 // 10 ms chunk. Hence, we don't need to wait for the reported system delay |
| 142 // values to become stable. | 143 // values to become stable. |
| 143 RenderAndCapture(kDeviceBufMs); | 144 RenderAndCapture(kDeviceBufMs); |
| 144 buffer_size += samples_per_frame_; | 145 buffer_size += samples_per_frame_; |
| 145 EXPECT_EQ(0, self_->startup_phase); | 146 EXPECT_EQ(0, self_->startup_phase); |
| 146 } else { | 147 } else { |
| 147 // A stable device should be accepted and put in a regular process mode | 148 // A stable device should be accepted and put in a regular process mode |
| 148 // within |kStableConvergenceMs|. | 149 // within |kStableConvergenceMs|. |
| 149 int process_time_ms = 0; | 150 int process_time_ms = 0; |
| 150 for (; process_time_ms < kStableConvergenceMs; process_time_ms += 10) { | 151 for (; process_time_ms < kStableConvergenceMs; process_time_ms += 10) { |
| 151 RenderAndCapture(kDeviceBufMs); | 152 RenderAndCapture(kDeviceBufMs); |
| 152 buffer_size += samples_per_frame_; | 153 buffer_size += samples_per_frame_; |
| 153 if (self_->startup_phase == 0) { | 154 if (self_->startup_phase == 0) { |
| 154 // We have left the startup phase. | 155 // We have left the startup phase. |
| 155 break; | 156 break; |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 // Verify convergence time. | 159 // Verify convergence time. |
| 159 EXPECT_GT(kStableConvergenceMs, process_time_ms); | 160 EXPECT_GT(kStableConvergenceMs, process_time_ms); |
| 160 } | 161 } |
| 161 // Verify that the buffer has been flushed. | 162 // Verify that the buffer has been flushed. |
| 162 EXPECT_GE(buffer_size, WebRtcAec_system_delay(self_->aec)); | 163 EXPECT_GE(static_cast<int>(buffer_size), |
| 164 WebRtcAec_system_delay(self_->aec)); |
| 163 } | 165 } |
| 164 | 166 |
| 165 int SystemDelayTest::MapBufferSizeToSamples(int size_in_ms, | 167 int SystemDelayTest::MapBufferSizeToSamples(int size_in_ms, |
| 166 bool extended_filter) { | 168 bool extended_filter) { |
| 167 // If extended_filter is disabled we add an extra 10 ms for the unprocessed | 169 // If extended_filter is disabled we add an extra 10 ms for the unprocessed |
| 168 // frame. That is simply how the algorithm is constructed. | 170 // frame. That is simply how the algorithm is constructed. |
| 169 return (size_in_ms + (extended_filter ? 0 : 10)) * samples_per_frame_ / 10; | 171 return static_cast<int>( |
| 172 (size_in_ms + (extended_filter ? 0 : 10)) * samples_per_frame_ / 10); |
| 170 } | 173 } |
| 171 | 174 |
| 172 // The tests should meet basic requirements and not be adjusted to what is | 175 // The tests should meet basic requirements and not be adjusted to what is |
| 173 // actually implemented. If we don't get good code coverage this way we either | 176 // actually implemented. If we don't get good code coverage this way we either |
| 174 // lack in tests or have unnecessary code. | 177 // lack in tests or have unnecessary code. |
| 175 // General requirements: | 178 // General requirements: |
| 176 // 1) If we add far-end data the system delay should be increased with the same | 179 // 1) If we add far-end data the system delay should be increased with the same |
| 177 // amount we add. | 180 // amount we add. |
| 178 // 2) If the far-end buffer is full we should flush the oldest data to make room | 181 // 2) If the far-end buffer is full we should flush the oldest data to make room |
| 179 // for the new. In this case the system delay is unaffected. | 182 // for the new. In this case the system delay is unaffected. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 200 for (int da_aec = 0; da_aec <= 1; ++da_aec) { | 203 for (int da_aec = 0; da_aec <= 1; ++da_aec) { |
| 201 WebRtcAec_enable_delay_agnostic(self_->aec, da_aec); | 204 WebRtcAec_enable_delay_agnostic(self_->aec, da_aec); |
| 202 EXPECT_EQ(da_aec, WebRtcAec_delay_agnostic_enabled(self_->aec)); | 205 EXPECT_EQ(da_aec, WebRtcAec_delay_agnostic_enabled(self_->aec)); |
| 203 for (size_t i = 0; i < kNumSampleRates; i++) { | 206 for (size_t i = 0; i < kNumSampleRates; i++) { |
| 204 Init(kSampleRateHz[i]); | 207 Init(kSampleRateHz[i]); |
| 205 // Loop through a couple of calls to make sure the system delay | 208 // Loop through a couple of calls to make sure the system delay |
| 206 // increments correctly. | 209 // increments correctly. |
| 207 for (int j = 1; j <= 5; j++) { | 210 for (int j = 1; j <= 5; j++) { |
| 208 EXPECT_EQ(0, | 211 EXPECT_EQ(0, |
| 209 WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_)); | 212 WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_)); |
| 210 EXPECT_EQ(j * samples_per_frame_, WebRtcAec_system_delay(self_->aec)); | 213 EXPECT_EQ(static_cast<int>(j * samples_per_frame_), |
| 214 WebRtcAec_system_delay(self_->aec)); |
| 211 } | 215 } |
| 212 } | 216 } |
| 213 } | 217 } |
| 214 } | 218 } |
| 215 } | 219 } |
| 216 | 220 |
| 217 // TODO(bjornv): Add a test to verify behavior if the far-end buffer is full | 221 // TODO(bjornv): Add a test to verify behavior if the far-end buffer is full |
| 218 // when adding new data. | 222 // when adding new data. |
| 219 | 223 |
| 220 TEST_F(SystemDelayTest, CorrectDelayAfterStableStartup) { | 224 TEST_F(SystemDelayTest, CorrectDelayAfterStableStartup) { |
| 221 // We run the system in a stable startup. After that we verify that the system | 225 // We run the system in a stable startup. After that we verify that the system |
| 222 // delay meets the requirements. | 226 // delay meets the requirements. |
| 223 // This process should be independent of DA-AEC and extended_filter mode. | 227 // This process should be independent of DA-AEC and extended_filter mode. |
| 224 for (int extended_filter = 0; extended_filter <= 1; ++extended_filter) { | 228 for (int extended_filter = 0; extended_filter <= 1; ++extended_filter) { |
| 225 WebRtcAec_enable_extended_filter(self_->aec, extended_filter); | 229 WebRtcAec_enable_extended_filter(self_->aec, extended_filter); |
| 226 EXPECT_EQ(extended_filter, WebRtcAec_extended_filter_enabled(self_->aec)); | 230 EXPECT_EQ(extended_filter, WebRtcAec_extended_filter_enabled(self_->aec)); |
| 227 for (int da_aec = 0; da_aec <= 1; ++da_aec) { | 231 for (int da_aec = 0; da_aec <= 1; ++da_aec) { |
| 228 WebRtcAec_enable_delay_agnostic(self_->aec, da_aec); | 232 WebRtcAec_enable_delay_agnostic(self_->aec, da_aec); |
| 229 EXPECT_EQ(da_aec, WebRtcAec_delay_agnostic_enabled(self_->aec)); | 233 EXPECT_EQ(da_aec, WebRtcAec_delay_agnostic_enabled(self_->aec)); |
| 230 for (size_t i = 0; i < kNumSampleRates; i++) { | 234 for (size_t i = 0; i < kNumSampleRates; i++) { |
| 231 Init(kSampleRateHz[i]); | 235 Init(kSampleRateHz[i]); |
| 232 RunStableStartup(); | 236 RunStableStartup(); |
| 233 | 237 |
| 234 // Verify system delay with respect to requirements, i.e., the | 238 // Verify system delay with respect to requirements, i.e., the |
| 235 // |system_delay| is in the interval [75%, 100%] of what's reported on | 239 // |system_delay| is in the interval [75%, 100%] of what's reported on |
| 236 // the average. | 240 // the average. |
| 237 // In extended_filter mode we target 50% and measure after one processed | 241 // In extended_filter mode we target 50% and measure after one processed |
| 238 // 10 ms chunk. | 242 // 10 ms chunk. |
| 239 int average_reported_delay = kDeviceBufMs * samples_per_frame_ / 10; | 243 int average_reported_delay = |
| 244 static_cast<int>(kDeviceBufMs * samples_per_frame_ / 10); |
| 240 EXPECT_GE(average_reported_delay, WebRtcAec_system_delay(self_->aec)); | 245 EXPECT_GE(average_reported_delay, WebRtcAec_system_delay(self_->aec)); |
| 241 int lower_bound = WebRtcAec_extended_filter_enabled(self_->aec) | 246 int lower_bound = WebRtcAec_extended_filter_enabled(self_->aec) |
| 242 ? average_reported_delay / 2 - samples_per_frame_ | 247 ? average_reported_delay / 2 - samples_per_frame_ |
| 243 : average_reported_delay * 3 / 4; | 248 : average_reported_delay * 3 / 4; |
| 244 EXPECT_LE(lower_bound, WebRtcAec_system_delay(self_->aec)); | 249 EXPECT_LE(lower_bound, WebRtcAec_system_delay(self_->aec)); |
| 245 } | 250 } |
| 246 } | 251 } |
| 247 } | 252 } |
| 248 } | 253 } |
| 249 | 254 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 260 // On the last frame the AEC buffer is adjusted to 60% of the last reported | 265 // On the last frame the AEC buffer is adjusted to 60% of the last reported |
| 261 // device buffer size. | 266 // device buffer size. |
| 262 // We construct an unstable system by altering the device buffer size between | 267 // We construct an unstable system by altering the device buffer size between |
| 263 // two values |kDeviceBufMs| +- 25 ms. | 268 // two values |kDeviceBufMs| +- 25 ms. |
| 264 for (size_t i = 0; i < kNumSampleRates; i++) { | 269 for (size_t i = 0; i < kNumSampleRates; i++) { |
| 265 Init(kSampleRateHz[i]); | 270 Init(kSampleRateHz[i]); |
| 266 | 271 |
| 267 // To make sure we have a full buffer when we verify stability we first fill | 272 // To make sure we have a full buffer when we verify stability we first fill |
| 268 // up the far-end buffer with the same amount as we will report in on the | 273 // up the far-end buffer with the same amount as we will report in on the |
| 269 // average through Process(). | 274 // average through Process(). |
| 270 int buffer_size = BufferFillUp(); | 275 size_t buffer_size = BufferFillUp(); |
| 271 | 276 |
| 272 int buffer_offset_ms = 25; | 277 int buffer_offset_ms = 25; |
| 273 int reported_delay_ms = 0; | 278 int reported_delay_ms = 0; |
| 274 int process_time_ms = 0; | 279 int process_time_ms = 0; |
| 275 for (; process_time_ms <= kMaxConvergenceMs; process_time_ms += 10) { | 280 for (; process_time_ms <= kMaxConvergenceMs; process_time_ms += 10) { |
| 276 reported_delay_ms = kDeviceBufMs + buffer_offset_ms; | 281 reported_delay_ms = kDeviceBufMs + buffer_offset_ms; |
| 277 RenderAndCapture(reported_delay_ms); | 282 RenderAndCapture(reported_delay_ms); |
| 278 buffer_size += samples_per_frame_; | 283 buffer_size += samples_per_frame_; |
| 279 buffer_offset_ms = -buffer_offset_ms; | 284 buffer_offset_ms = -buffer_offset_ms; |
| 280 if (self_->startup_phase == 0) { | 285 if (self_->startup_phase == 0) { |
| 281 // We have left the startup phase. | 286 // We have left the startup phase. |
| 282 break; | 287 break; |
| 283 } | 288 } |
| 284 } | 289 } |
| 285 // Verify convergence time. | 290 // Verify convergence time. |
| 286 EXPECT_GE(kMaxConvergenceMs, process_time_ms); | 291 EXPECT_GE(kMaxConvergenceMs, process_time_ms); |
| 287 // Verify that the buffer has been flushed. | 292 // Verify that the buffer has been flushed. |
| 288 EXPECT_GE(buffer_size, WebRtcAec_system_delay(self_->aec)); | 293 EXPECT_GE(static_cast<int>(buffer_size), |
| 294 WebRtcAec_system_delay(self_->aec)); |
| 289 | 295 |
| 290 // Verify system delay with respect to requirements, i.e., the | 296 // Verify system delay with respect to requirements, i.e., the |
| 291 // |system_delay| is in the interval [60%, 100%] of what's last reported. | 297 // |system_delay| is in the interval [60%, 100%] of what's last reported. |
| 292 EXPECT_GE(reported_delay_ms * samples_per_frame_ / 10, | 298 EXPECT_GE(static_cast<int>(reported_delay_ms * samples_per_frame_ / 10), |
| 293 WebRtcAec_system_delay(self_->aec)); | 299 WebRtcAec_system_delay(self_->aec)); |
| 294 EXPECT_LE(reported_delay_ms * samples_per_frame_ / 10 * 3 / 5, | 300 EXPECT_LE( |
| 295 WebRtcAec_system_delay(self_->aec)); | 301 static_cast<int>(reported_delay_ms * samples_per_frame_ / 10 * 3 / 5), |
| 302 WebRtcAec_system_delay(self_->aec)); |
| 296 } | 303 } |
| 297 } | 304 } |
| 298 | 305 |
| 299 TEST_F(SystemDelayTest, CorrectDelayAfterStableBufferBuildUp) { | 306 TEST_F(SystemDelayTest, CorrectDelayAfterStableBufferBuildUp) { |
| 300 // This test does not apply in extended_filter mode, since we only use the | 307 // This test does not apply in extended_filter mode, since we only use the |
| 301 // the first 10 ms chunk to determine a reasonable buffer size. Neither does | 308 // the first 10 ms chunk to determine a reasonable buffer size. Neither does |
| 302 // it apply if DA-AEC is on because that overrides the startup procedure. | 309 // it apply if DA-AEC is on because that overrides the startup procedure. |
| 303 WebRtcAec_enable_extended_filter(self_->aec, 0); | 310 WebRtcAec_enable_extended_filter(self_->aec, 0); |
| 304 EXPECT_EQ(0, WebRtcAec_extended_filter_enabled(self_->aec)); | 311 EXPECT_EQ(0, WebRtcAec_extended_filter_enabled(self_->aec)); |
| 305 WebRtcAec_enable_delay_agnostic(self_->aec, 0); | 312 WebRtcAec_enable_delay_agnostic(self_->aec, 0); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 324 &out_ptr_, | 331 &out_ptr_, |
| 325 samples_per_frame_, | 332 samples_per_frame_, |
| 326 kDeviceBufMs, | 333 kDeviceBufMs, |
| 327 0)); | 334 0)); |
| 328 } | 335 } |
| 329 // Verify that a buffer size has been established. | 336 // Verify that a buffer size has been established. |
| 330 EXPECT_EQ(0, self_->checkBuffSize); | 337 EXPECT_EQ(0, self_->checkBuffSize); |
| 331 | 338 |
| 332 // We now have established the required buffer size. Let us verify that we | 339 // We now have established the required buffer size. Let us verify that we |
| 333 // fill up before leaving the startup phase for normal processing. | 340 // fill up before leaving the startup phase for normal processing. |
| 334 int buffer_size = 0; | 341 size_t buffer_size = 0; |
| 335 int target_buffer_size = kDeviceBufMs * samples_per_frame_ / 10 * 3 / 4; | 342 size_t target_buffer_size = kDeviceBufMs * samples_per_frame_ / 10 * 3 / 4; |
| 336 process_time_ms = 0; | 343 process_time_ms = 0; |
| 337 for (; process_time_ms <= kMaxConvergenceMs; process_time_ms += 10) { | 344 for (; process_time_ms <= kMaxConvergenceMs; process_time_ms += 10) { |
| 338 RenderAndCapture(kDeviceBufMs); | 345 RenderAndCapture(kDeviceBufMs); |
| 339 buffer_size += samples_per_frame_; | 346 buffer_size += samples_per_frame_; |
| 340 if (self_->startup_phase == 0) { | 347 if (self_->startup_phase == 0) { |
| 341 // We have left the startup phase. | 348 // We have left the startup phase. |
| 342 break; | 349 break; |
| 343 } | 350 } |
| 344 } | 351 } |
| 345 // Verify convergence time. | 352 // Verify convergence time. |
| 346 EXPECT_GT(kMaxConvergenceMs, process_time_ms); | 353 EXPECT_GT(kMaxConvergenceMs, process_time_ms); |
| 347 // Verify that the buffer has reached the desired size. | 354 // Verify that the buffer has reached the desired size. |
| 348 EXPECT_LE(target_buffer_size, WebRtcAec_system_delay(self_->aec)); | 355 EXPECT_LE(static_cast<int>(target_buffer_size), |
| 356 WebRtcAec_system_delay(self_->aec)); |
| 349 | 357 |
| 350 // Verify normal behavior (system delay is kept constant) after startup by | 358 // Verify normal behavior (system delay is kept constant) after startup by |
| 351 // running a couple of calls to BufferFarend() and Process(). | 359 // running a couple of calls to BufferFarend() and Process(). |
| 352 for (int j = 0; j < 6; j++) { | 360 for (int j = 0; j < 6; j++) { |
| 353 int system_delay_before_calls = WebRtcAec_system_delay(self_->aec); | 361 int system_delay_before_calls = WebRtcAec_system_delay(self_->aec); |
| 354 RenderAndCapture(kDeviceBufMs); | 362 RenderAndCapture(kDeviceBufMs); |
| 355 EXPECT_EQ(system_delay_before_calls, WebRtcAec_system_delay(self_->aec)); | 363 EXPECT_EQ(system_delay_before_calls, WebRtcAec_system_delay(self_->aec)); |
| 356 } | 364 } |
| 357 } | 365 } |
| 358 } | 366 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 EXPECT_LE(0, WebRtcAec_system_delay(self_->aec)); | 593 EXPECT_LE(0, WebRtcAec_system_delay(self_->aec)); |
| 586 } | 594 } |
| 587 // Verify we are not in a non-causal state. | 595 // Verify we are not in a non-causal state. |
| 588 EXPECT_FALSE(non_causal); | 596 EXPECT_FALSE(non_causal); |
| 589 } | 597 } |
| 590 } | 598 } |
| 591 } | 599 } |
| 592 } | 600 } |
| 593 | 601 |
| 594 } // namespace | 602 } // namespace |
| OLD | NEW |