Index: webrtc/voice_engine/level_indicator.cc |
diff --git a/webrtc/voice_engine/level_indicator.cc b/webrtc/voice_engine/level_indicator.cc |
index f44ea8e3f0e6cca496811a3248608cf6ef4bde26..133afd50ecad7663649dc6389a4eac309794a700 100644 |
--- a/webrtc/voice_engine/level_indicator.cc |
+++ b/webrtc/voice_engine/level_indicator.cc |
@@ -19,80 +19,75 @@ namespace voe { |
// Number of bars on the indicator. |
// Note that the number of elements is specified because we are indexing it |
// in the range of 0-32 |
-const int8_t permutation[33] = |
- {0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9}; |
- |
+const int8_t permutation[33] = {0, 1, 2, 3, 4, 4, 5, 5, 5, 5, 6, |
+ 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, |
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; |
AudioLevel::AudioLevel() : |
_absMax(0), |
_count(0), |
_currentLevel(0), |
_currentLevelFullRange(0) { |
+ WebRtcSpl_Init(); |
minyue-webrtc
2016/08/15 06:26:15
I think clang format made irrelevant changes to th
aleloi
2016/08/15 11:52:13
Acknowledged.
minyue-webrtc
2016/08/15 15:58:37
I think there are still too many lines of changes.
|
} |
AudioLevel::~AudioLevel() { |
} |
-void AudioLevel::Clear() |
-{ |
- rtc::CritScope cs(&_critSect); |
- _absMax = 0; |
- _count = 0; |
- _currentLevel = 0; |
- _currentLevelFullRange = 0; |
+void AudioLevel::Clear() { |
+ rtc::CritScope cs(&_critSect); |
+ _absMax = 0; |
+ _count = 0; |
+ _currentLevel = 0; |
+ _currentLevelFullRange = 0; |
} |
-void AudioLevel::ComputeLevel(const AudioFrame& audioFrame) |
-{ |
- int16_t absValue(0); |
+void AudioLevel::ComputeLevel(const AudioFrame& audioFrame) { |
+ int16_t absValue(0); |
- // Check speech level (works for 2 channels as well) |
- absValue = WebRtcSpl_MaxAbsValueW16( |
- audioFrame.data_, |
- audioFrame.samples_per_channel_*audioFrame.num_channels_); |
+ // Check speech level (works for 2 channels as well) |
+ absValue = WebRtcSpl_MaxAbsValueW16( |
+ audioFrame.data_, |
+ audioFrame.samples_per_channel_ * audioFrame.num_channels_); |
- // Protect member access using a lock since this method is called on a |
- // dedicated audio thread in the RecordedDataIsAvailable() callback. |
- rtc::CritScope cs(&_critSect); |
+ // Protect member access using a lock since this method is called on a |
+ // dedicated audio thread in the RecordedDataIsAvailable() callback. |
+ rtc::CritScope cs(&_critSect); |
- if (absValue > _absMax) |
+ if (absValue > _absMax) |
_absMax = absValue; |
// Update level approximately 10 times per second |
- if (_count++ == kUpdateFrequency) |
- { |
- _currentLevelFullRange = _absMax; |
- |
- _count = 0; |
- |
- // Highest value for a int16_t is 0x7fff = 32767 |
- // Divide with 1000 to get in the range of 0-32 which is the range of |
- // the permutation vector |
- int32_t position = _absMax/1000; |
- |
- // Make it less likely that the bar stays at position 0. I.e. only if |
- // its in the range 0-250 (instead of 0-1000) |
- if ((position == 0) && (_absMax > 250)) |
- { |
- position = 1; |
- } |
- _currentLevel = permutation[position]; |
- |
- // Decay the absolute maximum (divide by 4) |
- _absMax >>= 2; |
+ if (_count++ == kUpdateFrequency) { |
+ _currentLevelFullRange = _absMax; |
+ |
+ _count = 0; |
+ |
+ // Highest value for a int16_t is 0x7fff = 32767 |
+ // Divide with 1000 to get in the range of 0-32 which is the range of |
+ // the permutation vector |
+ int32_t position = _absMax / 1000; |
+ |
+ // Make it less likely that the bar stays at position 0. I.e. only if |
+ // its in the range 0-250 (instead of 0-1000) |
+ if ((position == 0) && (_absMax > 250)) { |
+ position = 1; |
+ } |
+ _currentLevel = permutation[position]; |
+ |
+ // Decay the absolute maximum (divide by 4) |
+ _absMax >>= 2; |
} |
} |
-int8_t AudioLevel::Level() const |
-{ |
- rtc::CritScope cs(&_critSect); |
- return _currentLevel; |
+int8_t AudioLevel::Level() const { |
+ rtc::CritScope cs(&_critSect); |
+ return _currentLevel; |
} |
-int16_t AudioLevel::LevelFullRange() const |
-{ |
- rtc::CritScope cs(&_critSect); |
- return _currentLevelFullRange; |
+int16_t AudioLevel::LevelFullRange() const { |
+ rtc::CritScope cs(&_critSect); |
+ return _currentLevelFullRange; |
} |
} // namespace voe |