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

Side by Side Diff: content/renderer/media/media_stream_audio_level_calculator.cc

Issue 1076443002: Removed obsolete float_util.h as VS2013 supports standards well enough. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed mistake in value converter. Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_audio_level_calculator.h" 5 #include "content/renderer/media/media_stream_audio_level_calculator.h"
6 6
7 #include "base/float_util.h" 7 #include <cmath>
8
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "media/base/audio_bus.h" 11 #include "media/base/audio_bus.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 namespace { 15 namespace {
15 16
16 // Calculates the maximum absolute amplitude of the audio data. 17 // Calculates the maximum absolute amplitude of the audio data.
17 float MaxAmplitude(const float* audio_data, int length) { 18 float MaxAmplitude(const float* audio_data, int length) {
18 float max = 0.0f; 19 float max = 0.0f;
19 for (int i = 0; i < length; ++i) { 20 for (int i = 0; i < length; ++i) {
20 const float absolute = fabsf(audio_data[i]); 21 const float absolute = fabsf(audio_data[i]);
21 if (absolute > max) 22 if (absolute > max)
22 max = absolute; 23 max = absolute;
23 } 24 }
24 DCHECK(base::IsFinite(max)); 25 DCHECK(std::isfinite(max));
25 return max; 26 return max;
26 } 27 }
27 28
28 } // namespace 29 } // namespace
29 30
30 MediaStreamAudioLevelCalculator::MediaStreamAudioLevelCalculator() 31 MediaStreamAudioLevelCalculator::MediaStreamAudioLevelCalculator()
31 : counter_(0), 32 : counter_(0),
32 max_amplitude_(0.0f), 33 max_amplitude_(0.0f),
33 level_(0.0f) { 34 level_(0.0f) {
34 } 35 }
(...skipping 24 matching lines...) Expand all
59 max_amplitude_ /= 4.0f; 60 max_amplitude_ /= 4.0f;
60 61
61 // Reset the counter. 62 // Reset the counter.
62 counter_ = 0; 63 counter_ = 0;
63 } 64 }
64 65
65 return level_; 66 return level_;
66 } 67 }
67 68
68 } // namespace content 69 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/java/gin_java_bridge_value_converter_unittest.cc ('k') | dbus/values_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698