Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1500)

Unified Diff: webrtc/modules/audio_processing/level_controller/level_controller.cc

Issue 2268163004: Fix error when accumulating floats in an int. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Actually fix the problem. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/level_controller/level_controller.cc
diff --git a/webrtc/modules/audio_processing/level_controller/level_controller.cc b/webrtc/modules/audio_processing/level_controller/level_controller.cc
index bd8d439874899321035a00dfccc16614555a965e..a9fed9bf95ab04a9a0a6843e0616eb40e9034204 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<float> x) {
RTC_DCHECK(!x.empty());
float mean =
- std::accumulate(x.begin(), x.end(), 0) / static_cast<float>(x.size());
+ std::accumulate(x.begin(), x.end(), 0.0f) / static_cast<float>(x.size());
*dc_level += forgetting_factor * (mean - *dc_level);
for (float& v : x) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698