Chromium Code Reviews| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
| 13 | 13 |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/base/scoped_ptr.h" | 16 #include "webrtc/base/scoped_ptr.h" |
| 17 #include "webrtc/base/thread_checker.h" | |
| 17 #include "webrtc/common_audio/swap_queue.h" | 18 #include "webrtc/common_audio/swap_queue.h" |
| 18 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 19 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 19 #include "webrtc/modules/audio_processing/processing_component.h" | 20 #include "webrtc/modules/audio_processing/processing_component.h" |
| 20 | 21 |
| 21 namespace webrtc { | 22 namespace webrtc { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 // Functor to use when supplying a verifier function for the queue item | 25 // Functor to use when supplying a verifier function for the queue item |
| 25 // verifcation. | 26 // verifcation. |
| 26 class AgcRenderQueueItemVerifier { | 27 class AgcRenderQueueItemVerifier { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 38 | 39 |
| 39 } // namespace anonymous | 40 } // namespace anonymous |
| 40 | 41 |
| 41 class AudioBuffer; | 42 class AudioBuffer; |
| 42 class CriticalSectionWrapper; | 43 class CriticalSectionWrapper; |
| 43 | 44 |
| 44 class GainControlImpl : public GainControl, | 45 class GainControlImpl : public GainControl, |
| 45 public ProcessingComponent { | 46 public ProcessingComponent { |
| 46 public: | 47 public: |
| 47 GainControlImpl(const AudioProcessing* apm, | 48 GainControlImpl(const AudioProcessing* apm, |
| 48 CriticalSectionWrapper* crit); | 49 CriticalSectionWrapper* crit, |
| 50 rtc::ThreadChecker* render_thread_checker, | |
|
hlundin-webrtc
2015/11/05 13:08:55
const rtc::ThreadChecker*
peah-webrtc
2015/11/06 07:31:14
Done.
| |
| 51 rtc::ThreadChecker* capture_thread_checker); | |
|
hlundin-webrtc
2015/11/05 13:08:55
const rtc::ThreadChecker*
peah-webrtc
2015/11/06 07:31:14
Done.
| |
| 49 virtual ~GainControlImpl(); | 52 virtual ~GainControlImpl(); |
| 50 | 53 |
| 51 int ProcessRenderAudio(AudioBuffer* audio); | 54 int ProcessRenderAudio(AudioBuffer* audio); |
| 52 int AnalyzeCaptureAudio(AudioBuffer* audio); | 55 int AnalyzeCaptureAudio(AudioBuffer* audio); |
| 53 int ProcessCaptureAudio(AudioBuffer* audio); | 56 int ProcessCaptureAudio(AudioBuffer* audio); |
| 54 | 57 |
| 55 // ProcessingComponent implementation. | 58 // ProcessingComponent implementation. |
| 56 int Initialize() override; | 59 int Initialize() override; |
| 57 | 60 |
| 58 // GainControl implementation. | 61 // GainControl implementation. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 int InitializeHandle(void* handle) const override; | 93 int InitializeHandle(void* handle) const override; |
| 91 int ConfigureHandle(void* handle) const override; | 94 int ConfigureHandle(void* handle) const override; |
| 92 void DestroyHandle(void* handle) const override; | 95 void DestroyHandle(void* handle) const override; |
| 93 int num_handles_required() const override; | 96 int num_handles_required() const override; |
| 94 int GetHandleError(void* handle) const override; | 97 int GetHandleError(void* handle) const override; |
| 95 | 98 |
| 96 void AllocateRenderQueue(); | 99 void AllocateRenderQueue(); |
| 97 | 100 |
| 98 const AudioProcessing* apm_; | 101 const AudioProcessing* apm_; |
| 99 CriticalSectionWrapper* crit_; | 102 CriticalSectionWrapper* crit_; |
| 103 const rtc::ThreadChecker* const render_thread_checker_; | |
| 104 const rtc::ThreadChecker* const capture_thread_checker_; | |
| 100 Mode mode_; | 105 Mode mode_; |
| 101 int minimum_capture_level_; | 106 int minimum_capture_level_; |
| 102 int maximum_capture_level_; | 107 int maximum_capture_level_; |
| 103 bool limiter_enabled_; | 108 bool limiter_enabled_; |
| 104 int target_level_dbfs_; | 109 int target_level_dbfs_; |
| 105 int compression_gain_db_; | 110 int compression_gain_db_; |
| 106 std::vector<int> capture_levels_; | 111 std::vector<int> capture_levels_; |
| 107 int analog_capture_level_; | 112 int analog_capture_level_; |
| 108 bool was_analog_level_set_; | 113 bool was_analog_level_set_; |
| 109 bool stream_is_saturated_; | 114 bool stream_is_saturated_; |
| 110 | 115 |
| 111 size_t render_queue_element_max_size_; | 116 size_t render_queue_element_max_size_; |
| 112 std::vector<int16_t> render_queue_buffer_; | 117 std::vector<int16_t> render_queue_buffer_; |
| 113 std::vector<int16_t> capture_queue_buffer_; | 118 std::vector<int16_t> capture_queue_buffer_; |
| 114 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AgcRenderQueueItemVerifier> > | 119 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AgcRenderQueueItemVerifier> > |
| 115 render_signal_queue_; | 120 render_signal_queue_; |
| 116 }; | 121 }; |
| 117 } // namespace webrtc | 122 } // namespace webrtc |
| 118 | 123 |
| 119 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ | 124 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
| OLD | NEW |