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 0584b034ef3f9ddb6a696c65cc7d7985fa435e57..e81c3f2abf67d4473a67da7bcf9354c9eee07e0a 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" |
@@ -22,28 +23,35 @@ |
namespace webrtc { |
class AudioBuffer; |
-class CriticalSectionWrapper; |
class GainControlImpl : public GainControl, |
public ProcessingComponent { |
public: |
GainControlImpl(const AudioProcessing* apm, |
- CriticalSectionWrapper* crit, |
+ rtc::CriticalSection* crit_render, |
+ rtc::CriticalSection* crit_capture, |
const rtc::ThreadChecker* render_thread_checker, |
const rtc::ThreadChecker* capture_thread_checker); |
virtual ~GainControlImpl(); |
+ // Called with the render lock held. |
int ProcessRenderAudio(AudioBuffer* audio); |
+ // Called with the render lock held. |
int AnalyzeCaptureAudio(AudioBuffer* audio); |
+ // Called with the render lock held. |
int ProcessCaptureAudio(AudioBuffer* audio); |
// ProcessingComponent implementation. |
int Initialize() override; |
// GainControl implementation. |
+ // Acquires the capture lock. |
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; |
// Reads render side data that has been queued on the render call. |
@@ -51,20 +59,33 @@ class GainControlImpl : public GainControl, |
private: |
// GainControl implementation. |
+ // Aquires both the render and capture locks. |
int Enable(bool enable) override; |
+ // Acquires the capture lock. |
int set_stream_analog_level(int level) override; |
+ // Acquires both the render and capture locks. |
int set_mode(Mode mode) override; |
+ // Acquires the capture lock. |
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; |
// ProcessingComponent implementation. |
+ // Called with both locks held. |
void* CreateHandle() const override; |
int InitializeHandle(void* handle) const override; |
int ConfigureHandle(void* handle) const override; |
@@ -75,7 +96,8 @@ class GainControlImpl : public GainControl, |
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_; |