OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_VOICE_ENGINE_LEVEL_INDICATOR_H | |
12 #define WEBRTC_VOICE_ENGINE_LEVEL_INDICATOR_H | |
13 | |
14 #include "webrtc/base/criticalsection.h" | |
15 #include "webrtc/typedefs.h" | |
16 | |
17 namespace webrtc { | |
18 | |
19 class AudioFrame; | |
20 namespace voe { | |
21 | |
22 class AudioLevel | |
23 { | |
24 public: | |
25 AudioLevel(); | |
26 virtual ~AudioLevel(); | |
27 | |
28 // Called on "API thread(s)" from APIs like VoEBase::CreateChannel(), | |
29 // VoEBase::StopSend(), VoEVolumeControl::GetSpeechOutputLevel(). | |
30 int8_t Level() const; | |
31 int16_t LevelFullRange() const; | |
32 void Clear(); | |
33 | |
34 // Called on a native capture audio thread (platform dependent) from the | |
35 // AudioTransport::RecordedDataIsAvailable() callback. | |
36 // In Chrome, this method is called on the AudioInputDevice thread. | |
37 void ComputeLevel(const AudioFrame& audioFrame); | |
38 | |
39 private: | |
40 enum { kUpdateFrequency = 10}; | |
41 | |
42 rtc::CriticalSection _critSect; | |
43 | |
44 int16_t _absMax; | |
45 int16_t _count; | |
46 int8_t _currentLevel; | |
47 int16_t _currentLevelFullRange; | |
48 }; | |
49 | |
50 } // namespace voe | |
51 | |
52 } // namespace webrtc | |
53 | |
54 #endif // WEBRTC_VOICE_ENGINE_LEVEL_INDICATOR_H | |
OLD | NEW |