OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 14 matching lines...) Expand all Loading... | |
25 // The expected approach is to provide constant-sized chunks of audio to | 25 // The expected approach is to provide constant-sized chunks of audio to |
26 // Analyze(). When enough chunks have been accumulated to form a packet, call | 26 // Analyze(). When enough chunks have been accumulated to form a packet, call |
27 // Average() to get the audio level indicator for the RTP header. | 27 // Average() to get the audio level indicator for the RTP header. |
28 class RmsLevel { | 28 class RmsLevel { |
29 public: | 29 public: |
30 struct Levels { | 30 struct Levels { |
31 int average; | 31 int average; |
32 int peak; | 32 int peak; |
33 }; | 33 }; |
34 | 34 |
35 static constexpr int kMinLevelDb = 127; | |
hlundin-webrtc
2016/11/29 11:03:55
Had to move this back out to the public part of th
| |
36 | |
35 RmsLevel(); | 37 RmsLevel(); |
36 ~RmsLevel(); | 38 ~RmsLevel(); |
37 | 39 |
38 // Can be called to reset internal states, but is not required during normal | 40 // Can be called to reset internal states, but is not required during normal |
39 // operation. | 41 // operation. |
40 void Reset(); | 42 void Reset(); |
41 | 43 |
42 // Pass each chunk of audio to Analyze() to accumulate the level. | 44 // Pass each chunk of audio to Analyze() to accumulate the level. |
43 void Analyze(rtc::ArrayView<const int16_t> data); | 45 void Analyze(rtc::ArrayView<const int16_t> data); |
44 | 46 |
(...skipping 19 matching lines...) Expand all Loading... | |
64 float sum_square_; | 66 float sum_square_; |
65 size_t sample_count_; | 67 size_t sample_count_; |
66 float max_sum_square_; | 68 float max_sum_square_; |
67 rtc::Optional<size_t> block_size_; | 69 rtc::Optional<size_t> block_size_; |
68 }; | 70 }; |
69 | 71 |
70 } // namespace webrtc | 72 } // namespace webrtc |
71 | 73 |
72 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_ | 74 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_ |
73 | 75 |
OLD | NEW |