Chromium Code Reviews| Index: webrtc/modules/audio_processing/utility/delay_estimator.cc |
| diff --git a/webrtc/modules/audio_processing/utility/delay_estimator.cc b/webrtc/modules/audio_processing/utility/delay_estimator.cc |
| index 15a67472b176a0cd549c73db302bdc9b73eb3162..9d799a34971c944e990f678a28982bdf2e056db8 100644 |
| --- a/webrtc/modules/audio_processing/utility/delay_estimator.cc |
| +++ b/webrtc/modules/audio_processing/utility/delay_estimator.cc |
| @@ -618,15 +618,32 @@ int WebRtc_ProcessBinarySpectrum(BinaryDelayEstimator* self, |
| ((value_best_candidate < self->minimum_probability) || |
| (value_best_candidate < self->last_delay_probability))); |
| - UpdateRobustValidationStatistics(self, candidate_delay, valley_depth, |
| - value_best_candidate); |
| + // Check for nonstationary farend signal. |
| + bool non_stationary_farend = false; |
|
hlundin-webrtc
2016/05/11 12:39:48
You are traversing the array from end to beginning
peah-webrtc
2016/05/11 12:53:33
Wow! That was great!! And works splendidly. Thanks
|
| + for (i = self->history_size - 1; i >= 0; --i) { |
| + if (self->farend->far_bit_counts[i] > 0) { |
| + non_stationary_farend = true; |
| + break; |
| + } |
| + } |
| + |
| + if (non_stationary_farend) { |
| + // Only update the validation statistics when the farend is nonstationary |
| + // as the underlying estimates are otherwise freezed. |
|
hlundin-webrtc
2016/05/11 12:39:48
frozen
peah-webrtc
2016/05/11 12:53:33
Done.
|
| + UpdateRobustValidationStatistics(self, candidate_delay, valley_depth, |
| + value_best_candidate); |
| + } |
| + |
| if (self->robust_validation_enabled) { |
| int is_histogram_valid = HistogramBasedValidation(self, candidate_delay); |
| valid_candidate = RobustValidation(self, candidate_delay, valid_candidate, |
| is_histogram_valid); |
| } |
| - if (valid_candidate) { |
| + |
| + // Only update the delay estimate when the farend is nonstationary and when |
| + // a valid delay candidate is available. |
| + if (non_stationary_farend && valid_candidate) { |
| if (candidate_delay != self->last_delay) { |
| self->last_delay_histogram = |
| (self->histogram[candidate_delay] > kLastHistogramMax ? |