diff --git a/data/audio_processing/output_data_float.pb b/data/audio_processing/output_data_float.pb index cadc1d300b..b63ff92532 100644 Binary files a/data/audio_processing/output_data_float.pb and b/data/audio_processing/output_data_float.pb differ diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c index bfa087c23d..4f4ce034ea 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.c +++ b/webrtc/modules/audio_processing/aec/aec_core.c @@ -475,6 +475,17 @@ int WebRtcAec_InitAec(AecCore* aec, int sampFreq) { aec->extended_filter_enabled = 0; aec->num_partitions = kNormalNumPartitions; + // Update the delay estimator with filter length. We use half the + // |num_partitions| to take the echo path into account. In practice we say + // that the echo has a duration of maximum half |num_partitions|, which is not + // true, but serves as a crude measure. + WebRtc_set_allowed_offset(aec->delay_estimator, aec->num_partitions / 2); + // TODO(bjornv): I currently hard coded the enable. Once we've established + // that AECM has no performance regression, robust_validation will be enabled + // all the time and the APIs to turn it on/off will be removed. Hence, remove + // this line then. + WebRtc_enable_robust_validation(aec->delay_estimator, 1); + // Default target suppression mode. aec->nlp_mode = 1; @@ -771,6 +782,8 @@ void WebRtcAec_SetConfigCore(AecCore* self, void WebRtcAec_enable_delay_correction(AecCore* self, int enable) { self->extended_filter_enabled = enable; self->num_partitions = enable ? kExtendedNumPartitions : kNormalNumPartitions; + // Update the delay estimator with filter length. See InitAEC() for details. + WebRtc_set_allowed_offset(self->delay_estimator, self->num_partitions / 2); } int WebRtcAec_delay_correction_enabled(AecCore* self) { diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c index fc94f1b889..0f34874612 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core.c @@ -266,6 +266,9 @@ int WebRtcAecm_CreateCore(AecmCore_t **aecmInst) aecm = NULL; return -1; } + // TODO(bjornv): Explicitly disable robust delay validation until no + // performance regression has been established. Then remove the line. + WebRtc_enable_robust_validation(aecm->delay_estimator, 0); aecm->real_fft = WebRtcSpl_CreateRealFFT(PART_LEN_SHIFT); if (aecm->real_fft == NULL) { diff --git a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc index 6eab1e88b8..6f1ee277e6 100644 --- a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc +++ b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc @@ -50,6 +50,8 @@ using webrtc::EchoControlMobile; using webrtc::VoiceDetection; namespace { +// TODO(bjornv): This is not feasible until the functionality has been +// re-implemented; see comment at the bottom of this file. // When false, this will compare the output data with the results stored to // file. This is the typical case. When the file should be updated, it can // be set to true with the command-line switch --write_ref_data. @@ -469,10 +471,10 @@ void ApmTest::ProcessDelayVerificationTest(int delay_ms, int system_delay_ms, frame_queue.push(frame); frame_delay--; } - // Run for 4.5 seconds, skipping statistics from the first second. We need - // enough frames with audio to have reliable estimates, but as few as possible - // to keep processing time down. 4.5 seconds seemed to be a good compromise - // for this recording. + // Run for 4.5 seconds, skipping statistics from the first 2.5 seconds. We + // need enough frames with audio to have reliable estimates, but as few as + // possible to keep processing time down. 4.5 seconds seemed to be a good + // compromise for this recording. for (int frame_count = 0; frame_count < 450; ++frame_count) { webrtc::AudioFrame* frame = new AudioFrame(); frame->CopyFrom(tmp_frame); @@ -496,7 +498,7 @@ void ApmTest::ProcessDelayVerificationTest(int delay_ms, int system_delay_ms, frame_queue.pop(); delete frame; - if (frame_count == 100) { + if (frame_count == 250) { int median; int std; // Discard the first delay metrics to avoid convergence effects.