OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 _currentLevel(0) | 21 _currentLevel(0) |
22 { | 22 { |
23 } | 23 } |
24 | 24 |
25 LevelIndicator::~LevelIndicator() | 25 LevelIndicator::~LevelIndicator() |
26 { | 26 { |
27 } | 27 } |
28 | 28 |
29 // Level is based on the highest absolute value for all samples. | 29 // Level is based on the highest absolute value for all samples. |
30 void LevelIndicator::ComputeLevel(const int16_t* speech, | 30 void LevelIndicator::ComputeLevel(const int16_t* speech, |
31 const uint16_t nrOfSamples) | 31 const size_t nrOfSamples) |
32 { | 32 { |
33 int32_t min = 0; | 33 int32_t min = 0; |
34 for(uint32_t i = 0; i < nrOfSamples; i++) | 34 for(size_t i = 0; i < nrOfSamples; i++) |
35 { | 35 { |
36 if(_max < speech[i]) | 36 if(_max < speech[i]) |
37 { | 37 { |
38 _max = speech[i]; | 38 _max = speech[i]; |
39 } | 39 } |
40 if(min > speech[i]) | 40 if(min > speech[i]) |
41 { | 41 { |
42 min = speech[i]; | 42 min = speech[i]; |
43 } | 43 } |
44 } | 44 } |
(...skipping 22 matching lines...) Expand all Loading... |
67 _count++; | 67 _count++; |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 int32_t LevelIndicator::GetLevel() | 71 int32_t LevelIndicator::GetLevel() |
72 { | 72 { |
73 return _currentLevel; | 73 return _currentLevel; |
74 } | 74 } |
75 | 75 |
76 } // namespace webrtc | 76 } // namespace webrtc |
OLD | NEW |