| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 22 matching lines...) Expand all Loading... |
| 33 // left) channel. | 33 // left) channel. |
| 34 virtual int Process(const int16_t* audio, size_t length, int sample_rate_hz); | 34 virtual int Process(const int16_t* audio, size_t length, int sample_rate_hz); |
| 35 | 35 |
| 36 // Retrieves the difference between the target RMS level and the current | 36 // Retrieves the difference between the target RMS level and the current |
| 37 // signal RMS level in dB. Returns true if an update is available and false | 37 // signal RMS level in dB. Returns true if an update is available and false |
| 38 // otherwise, in which case |error| should be ignored and no action taken. | 38 // otherwise, in which case |error| should be ignored and no action taken. |
| 39 virtual bool GetRmsErrorDb(int* error); | 39 virtual bool GetRmsErrorDb(int* error); |
| 40 virtual void Reset(); | 40 virtual void Reset(); |
| 41 | 41 |
| 42 virtual int set_target_level_dbfs(int level); | 42 virtual int set_target_level_dbfs(int level); |
| 43 virtual int target_level_dbfs() const { return target_level_dbfs_; } | 43 virtual int target_level_dbfs() const; |
| 44 | 44 virtual float voice_probability() const; |
| 45 virtual float voice_probability() const { | |
| 46 return vad_.last_voice_probability(); | |
| 47 } | |
| 48 | 45 |
| 49 private: | 46 private: |
| 50 double target_level_loudness_; | 47 double target_level_loudness_; |
| 51 int target_level_dbfs_; | 48 int target_level_dbfs_; |
| 52 std::unique_ptr<LoudnessHistogram> histogram_; | 49 std::unique_ptr<LoudnessHistogram> histogram_; |
| 53 std::unique_ptr<LoudnessHistogram> inactive_histogram_; | 50 std::unique_ptr<LoudnessHistogram> inactive_histogram_; |
| 54 VoiceActivityDetector vad_; | 51 VoiceActivityDetector vad_; |
| 55 }; | 52 }; |
| 56 | 53 |
| 57 } // namespace webrtc | 54 } // namespace webrtc |
| 58 | 55 |
| 59 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ | 56 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ |
| OLD | NEW |