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 |
11 #ifndef WEBRTC_VOICE_ENGINE_AUDIO_LEVEL_H_ | 11 #ifndef WEBRTC_VOICE_ENGINE_AUDIO_LEVEL_H_ |
12 #define WEBRTC_VOICE_ENGINE_AUDIO_LEVEL_H_ | 12 #define WEBRTC_VOICE_ENGINE_AUDIO_LEVEL_H_ |
13 | 13 |
14 #include "webrtc/rtc_base/criticalsection.h" | 14 #include "webrtc/rtc_base/criticalsection.h" |
| 15 #include "webrtc/rtc_base/thread_annotations.h" |
15 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
16 | 17 |
17 namespace webrtc { | 18 namespace webrtc { |
18 | 19 |
19 class AudioFrame; | 20 class AudioFrame; |
20 namespace voe { | 21 namespace voe { |
21 | 22 |
22 class AudioLevel { | 23 class AudioLevel { |
23 public: | 24 public: |
24 AudioLevel(); | 25 AudioLevel(); |
(...skipping 12 matching lines...) Expand all Loading... |
37 // Called on a native capture audio thread (platform dependent) from the | 38 // Called on a native capture audio thread (platform dependent) from the |
38 // AudioTransport::RecordedDataIsAvailable() callback. | 39 // AudioTransport::RecordedDataIsAvailable() callback. |
39 // In Chrome, this method is called on the AudioInputDevice thread. | 40 // In Chrome, this method is called on the AudioInputDevice thread. |
40 void ComputeLevel(const AudioFrame& audioFrame, double duration); | 41 void ComputeLevel(const AudioFrame& audioFrame, double duration); |
41 | 42 |
42 private: | 43 private: |
43 enum { kUpdateFrequency = 10 }; | 44 enum { kUpdateFrequency = 10 }; |
44 | 45 |
45 rtc::CriticalSection crit_sect_; | 46 rtc::CriticalSection crit_sect_; |
46 | 47 |
47 int16_t abs_max_; | 48 int16_t abs_max_ GUARDED_BY(crit_sect_); |
48 int16_t count_; | 49 int16_t count_ GUARDED_BY(crit_sect_); |
49 int8_t current_level_; | 50 int8_t current_level_ GUARDED_BY(crit_sect_); |
50 int16_t current_level_full_range_; | 51 int16_t current_level_full_range_ GUARDED_BY(crit_sect_); |
51 | 52 |
52 double total_energy_ = 0.0; | 53 double total_energy_ GUARDED_BY(crit_sect_) = 0.0; |
53 double total_duration_ = 0.0; | 54 double total_duration_ GUARDED_BY(crit_sect_) = 0.0; |
54 }; | 55 }; |
55 | 56 |
56 } // namespace voe | 57 } // namespace voe |
57 } // namespace webrtc | 58 } // namespace webrtc |
58 | 59 |
59 #endif // WEBRTC_VOICE_ENGINE_AUDIO_LEVEL_H_ | 60 #endif // WEBRTC_VOICE_ENGINE_AUDIO_LEVEL_H_ |
OLD | NEW |