From 3f746ea26a74311651ae91d44b75e37ab17a7481 Mon Sep 17 00:00:00 2001 From: maxmorin Date: Thu, 25 Aug 2016 04:00:20 -0700 Subject: [PATCH] Fix error when accumulating floats in an int. I saw this when browsing the code, I think the intended behavior is accumulating to a float. BUG=none Review-Url: https://codereview.webrtc.org/2268163004 Cr-Commit-Position: refs/heads/master@{#13918} --- .../audio_processing/level_controller/level_controller.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/modules/audio_processing/level_controller/level_controller.cc b/webrtc/modules/audio_processing/level_controller/level_controller.cc index bd8d439874..a9fed9bf95 100644 --- a/webrtc/modules/audio_processing/level_controller/level_controller.cc +++ b/webrtc/modules/audio_processing/level_controller/level_controller.cc @@ -35,7 +35,7 @@ void UpdateAndRemoveDcLevel(float forgetting_factor, rtc::ArrayView x) { RTC_DCHECK(!x.empty()); float mean = - std::accumulate(x.begin(), x.end(), 0) / static_cast(x.size()); + std::accumulate(x.begin(), x.end(), 0.0f) / static_cast(x.size()); *dc_level += forgetting_factor * (mean - *dc_level); for (float& v : x) {