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}
This commit is contained in:
maxmorin
2016-08-25 04:00:20 -07:00
committed by Commit bot
parent e29352bb34
commit 3f746ea26a

View File

@ -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) {