Chromium Code Reviews| Index: webrtc/modules/audio_processing/gain_control_impl.h |
| diff --git a/webrtc/modules/audio_processing/gain_control_impl.h b/webrtc/modules/audio_processing/gain_control_impl.h |
| index d3eab9d9c0b445523c458e665b448ad2471055b6..da7ff745713bdcc13cfe4e9871824f6b38a9c458 100644 |
| --- a/webrtc/modules/audio_processing/gain_control_impl.h |
| +++ b/webrtc/modules/audio_processing/gain_control_impl.h |
| @@ -13,6 +13,7 @@ |
| #include <vector> |
| +#include "webrtc/base/criticalsection.h" |
| #include "webrtc/base/scoped_ptr.h" |
| #include "webrtc/base/thread_checker.h" |
| #include "webrtc/common_audio/swap_queue.h" |
| @@ -45,24 +46,29 @@ class CriticalSectionWrapper; |
| class GainControlImpl : public GainControl, |
| public ProcessingComponent { |
| public: |
| + // Called with both locks held. |
|
hlundin-webrtc
2015/11/05 16:11:22
Is this still true?
peah-webrtc
2015/11/06 09:54:33
Done.
|
| GainControlImpl(const AudioProcessing* apm, |
| - CriticalSectionWrapper* crit, |
| + rtc::CriticalSection* crit_render, |
| + rtc::CriticalSection* crit_capture, |
| rtc::ThreadChecker* render_thread_checker, |
| rtc::ThreadChecker* capture_thread_checker); |
| - virtual ~GainControlImpl(); |
| + virtual ~GainControlImpl(); // Called with both locks held. |
|
hlundin-webrtc
2015/11/05 16:11:23
Still true?
peah-webrtc
2015/11/06 09:54:32
Done.
|
| - int ProcessRenderAudio(AudioBuffer* audio); |
| - int AnalyzeCaptureAudio(AudioBuffer* audio); |
| - int ProcessCaptureAudio(AudioBuffer* audio); |
| + int ProcessRenderAudio( |
|
hlundin-webrtc
2015/11/05 16:11:22
Same nagging about putting the comments on separat
peah-webrtc
2015/11/06 09:54:33
Fully and totally well motivated!
Done.
|
| + AudioBuffer* audio); // Called with the render lock held. |
| + int AnalyzeCaptureAudio( |
| + AudioBuffer* audio); // Called with the capture lock held. |
| + int ProcessCaptureAudio( |
| + AudioBuffer* audio); // Called with the capture lock held. |
| // ProcessingComponent implementation. |
| int Initialize() override; |
| // GainControl implementation. |
| - bool is_enabled() const override; |
| - int stream_analog_level() override; |
| - bool is_limiter_enabled() const override; |
| - Mode mode() const override; |
| + bool is_enabled() const override; // Acquires the capture lock. |
| + int stream_analog_level() override; // Acquires the capture lock. |
| + bool is_limiter_enabled() const override; // Acquires the capture lock. |
| + Mode mode() const override; // Acquires the capture lock. |
| // Reads render side data that has been queued on the render call. |
| void ReadQueuedRenderData(); |
| @@ -75,31 +81,40 @@ class GainControlImpl : public GainControl, |
| static const size_t kMaxNumFramesToBuffer = 100; |
| // GainControl implementation. |
| - int Enable(bool enable) override; |
| - int set_stream_analog_level(int level) override; |
| - int set_mode(Mode mode) override; |
| - int set_target_level_dbfs(int level) override; |
| - int target_level_dbfs() const override; |
| - int set_compression_gain_db(int gain) override; |
| - int compression_gain_db() const override; |
| - int enable_limiter(bool enable) override; |
| - int set_analog_level_limits(int minimum, int maximum) override; |
| - int analog_level_minimum() const override; |
| - int analog_level_maximum() const override; |
| - bool stream_is_saturated() const override; |
| + int Enable( |
| + bool enable) override; // Aquires both the render and capture locks. |
| + int set_stream_analog_level( |
| + int level) override; // Acquires the capture lock. |
| + int set_mode( |
| + Mode mode) override; // Acquires both the render and capture locks. |
| + int set_target_level_dbfs(int level) override; // Acquires the capture lock. |
| + int target_level_dbfs() const override; // Acquires the capture lock. |
| + int set_compression_gain_db(int gain) override; // Acquires the capture lock. |
| + int compression_gain_db() const override; // Acquires the capture lock. |
| + int enable_limiter(bool enable) override; // Acquires the capture lock. |
| + int set_analog_level_limits(int minimum, int maximum) |
| + override; // Acquires the capture lock. |
| + int analog_level_minimum() const override; // Acquires the capture lock. |
| + int analog_level_maximum() const override; // Acquires the capture lock. |
| + bool stream_is_saturated() const override; // Acquires the capture lock. |
| // ProcessingComponent implementation. |
| - void* CreateHandle() const override; |
| - int InitializeHandle(void* handle) const override; |
| - int ConfigureHandle(void* handle) const override; |
| - void DestroyHandle(void* handle) const override; |
| - int num_handles_required() const override; |
| - int GetHandleError(void* handle) const override; |
| + void* CreateHandle() const override; // Called with both locks held. |
| + int InitializeHandle( |
| + void* handle) const override; // Called with both locks held. |
| + int ConfigureHandle( |
| + void* handle) const override; // Called with both locks held. |
| + void DestroyHandle( |
| + void* handle) const override; // Called with both locks held. |
| + int num_handles_required() const override; // Called with both locks held. |
| + int GetHandleError( |
| + void* handle) const override; // Called with both locks held. |
| void AllocateRenderQueue(); |
| const AudioProcessing* apm_; |
| - CriticalSectionWrapper* crit_; |
| + rtc::CriticalSection* const crit_render_; |
| + rtc::CriticalSection* const crit_capture_; |
| const rtc::ThreadChecker* const render_thread_checker_; |
| const rtc::ThreadChecker* const capture_thread_checker_; |
| Mode mode_; |