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

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: 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..7f86552dfa48681894e4580517b9b182567e51bb 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.0) / static_cast<float>(x.size());
the sun 2016/08/24 19:41:32 Nice catch! Make it a 0.0f so we're not using doub
*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