Chromium Code Reviews| Index: webrtc/modules/audio_processing/aec/aec_core.c |
| diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c |
| index 063201586ad48d7d3af34508c4d1874cb5363b8b..e7068c5e1b6f6647033e66bfc9c421cebc9d65fb 100644 |
| --- a/webrtc/modules/audio_processing/aec/aec_core.c |
| +++ b/webrtc/modules/audio_processing/aec/aec_core.c |
| @@ -820,8 +820,12 @@ static void UpdateDelayMetrics(AecCore* self) { |
| // negative (anti-causal system) or larger than the AEC filter length. |
| { |
| int num_delays_out_of_bounds = self->num_delay_values; |
| - for (i = lookahead; i < lookahead + self->num_partitions; ++i) { |
| - num_delays_out_of_bounds -= self->delay_histogram[i]; |
| + const int histogram_length = sizeof(self->delay_histogram) / |
| + sizeof(self->delay_histogram[0]); |
| + for (i = lookahead; |
| + ((i < lookahead + self->num_partitions) && (i < histogram_length)); |
|
hlundin-webrtc
2015/09/14 07:34:48
You don't need the outer parentheses, and I don't
peah-webrtc
2015/09/14 07:56:07
Acknowledged.
|
| + ++i) { |
| + num_delays_out_of_bounds -= self->delay_histogram[i]; |
| } |
| self->fraction_poor_delays = (float)num_delays_out_of_bounds / |
| self->num_delay_values; |