Index: webrtc/modules/audio_processing/audio_processing_impl.h |
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h |
index c50d7e7986c8477b5d76201d42923653536bf48e..2f583530fc0ad3a6aada9132d046405def8f4e7c 100644 |
--- a/webrtc/modules/audio_processing/audio_processing_impl.h |
+++ b/webrtc/modules/audio_processing/audio_processing_impl.h |
@@ -15,6 +15,7 @@ |
#include <string> |
#include <vector> |
+#include "webrtc/base/criticalsection.h" |
#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/base/thread_annotations.h" |
#include "webrtc/base/thread_checker.h" |
@@ -99,7 +100,8 @@ class AudioProcessingImpl : public AudioProcessing { |
float* const* dest) override; |
int set_stream_delay_ms(int delay) override; |
int stream_delay_ms() const override; |
- bool was_stream_delay_set() const override; |
+ bool was_stream_delay_set() const override |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
void set_delay_offset_ms(int offset) override; |
int delay_offset_ms() const override; |
void set_stream_key_pressed(bool key_pressed) override; |
@@ -118,31 +120,40 @@ class AudioProcessingImpl : public AudioProcessing { |
protected: |
// Overridden in a mock. |
- virtual int InitializeLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
+ virtual int InitializeLocked() |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
private: |
int InitializeLocked(const ProcessingConfig& config) |
- EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- int MaybeInitializeLocked(const ProcessingConfig& config) |
- EXCLUSIVE_LOCKS_REQUIRED(crit_); |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
+ int MaybeInitialize(const ProcessingConfig& config) |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
// TODO(ekm): Remove once all clients updated to new interface. |
- int AnalyzeReverseStream(const float* const* src, |
- const StreamConfig& input_config, |
- const StreamConfig& output_config); |
- int ProcessStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- |
- bool is_data_processed() const; |
- bool output_copy_needed(bool is_data_processed) const; |
- bool synthesis_needed(bool is_data_processed) const; |
- bool analysis_needed(bool is_data_processed) const; |
- bool is_rev_processed() const; |
- bool rev_conversion_needed() const; |
- void InitializeExperimentalAgc() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- void InitializeTransient() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- void InitializeBeamformer() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- void InitializeIntelligibility() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
- void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
+ int AnalyzeReverseStreamLocked(const float* const* src, |
+ const StreamConfig& input_config, |
+ const StreamConfig& output_config) |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
+ int ProcessStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
+ int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
+ |
+ bool is_data_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
+ bool output_copy_needed(bool is_data_processed) const |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
+ bool synthesis_needed(bool is_data_processed) const |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
+ bool analysis_needed(bool is_data_processed) const |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
+ bool is_rev_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
+ bool rev_conversion_needed() const EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
+ void InitializeExperimentalAgc() |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
+ void InitializeTransient() |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
+ void InitializeBeamformer() |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
+ void InitializeIntelligibility() |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
+ void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
EchoCancellationImpl* echo_cancellation_; |
EchoControlMobileImpl* echo_control_mobile_; |
@@ -153,13 +164,14 @@ class AudioProcessingImpl : public AudioProcessing { |
VoiceDetectionImpl* voice_detection_; |
rtc::scoped_ptr<GainControlForNewAgc> gain_control_for_new_agc_; |
- std::list<ProcessingComponent*> component_list_; |
- CriticalSectionWrapper* crit_; |
+ std::list<ProcessingComponent*> component_list_ GUARDED_BY(crit_capture_); |
+ mutable rtc::CriticalSection crit_render_ ACQUIRED_BEFORE(crit_capture_); |
+ mutable rtc::CriticalSection crit_capture_; |
rtc::ThreadChecker render_thread_; |
rtc::ThreadChecker capture_thread_; |
- rtc::scoped_ptr<AudioBuffer> render_audio_; |
- rtc::scoped_ptr<AudioBuffer> capture_audio_; |
- rtc::scoped_ptr<AudioConverter> render_converter_; |
+ rtc::scoped_ptr<AudioBuffer> render_audio_ GUARDED_BY(crit_render_); |
+ rtc::scoped_ptr<AudioBuffer> capture_audio_ GUARDED_BY(crit_capture_); |
+ rtc::scoped_ptr<AudioConverter> render_converter_ GUARDED_BY(crit_render_); |
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
// TODO(andrew): make this more graceful. Ideally we would split this stuff |
// out into a separate class with an "enabled" and "disabled" implementation. |
@@ -169,7 +181,7 @@ class AudioProcessingImpl : public AudioProcessing { |
// Writes Config message. If not |forced|, only writes the current config if |
// it is different from the last saved one; if |forced|, writes the config |
// regardless of the last saved. |
- int WriteConfigMessage(bool forced); |
+ int WriteConfigMessage(bool forced) EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
rtc::scoped_ptr<FileWrapper> debug_file_; |
rtc::scoped_ptr<audioproc::Event> event_msg_; // Protobuf message. |
@@ -198,28 +210,32 @@ class AudioProcessingImpl : public AudioProcessing { |
StreamConfig rev_proc_format_; |
int split_rate_; |
- int stream_delay_ms_; |
- int delay_offset_ms_; |
- bool was_stream_delay_set_; |
- int last_stream_delay_ms_; |
- int last_aec_system_delay_ms_; |
- int stream_delay_jumps_; |
- int aec_system_delay_jumps_; |
+ int stream_delay_ms_ GUARDED_BY(crit_capture_); |
+ int delay_offset_ms_ GUARDED_BY(crit_capture_); |
+ bool was_stream_delay_set_ GUARDED_BY(crit_capture_); |
+ int last_stream_delay_ms_ GUARDED_BY(crit_capture_); |
+ int last_aec_system_delay_ms_ GUARDED_BY(crit_capture_); |
+ int stream_delay_jumps_ GUARDED_BY(crit_capture_); |
+ int aec_system_delay_jumps_ GUARDED_BY(crit_capture_); |
- bool output_will_be_muted_ GUARDED_BY(crit_); |
+ bool output_will_be_muted_ GUARDED_BY(crit_capture_); |
- bool key_pressed_; |
+ bool key_pressed_ GUARDED_BY(crit_capture_); |
// Only set through the constructor's Config parameter. |
const bool use_new_agc_; |
- rtc::scoped_ptr<AgcManagerDirect> agc_manager_ GUARDED_BY(crit_); |
- int agc_startup_min_volume_; |
- |
- bool transient_suppressor_enabled_; |
- rtc::scoped_ptr<TransientSuppressor> transient_suppressor_; |
- const bool beamformer_enabled_; |
- rtc::scoped_ptr<Beamformer<float>> beamformer_; |
- const std::vector<Point> array_geometry_; |
+ rtc::scoped_ptr<AgcManagerDirect> agc_manager_ GUARDED_BY(crit_capture_); |
+ int agc_startup_min_volume_ GUARDED_BY(crit_render_) |
+ GUARDED_BY(crit_capture_); |
+ |
+ bool transient_suppressor_enabled_ GUARDED_BY(crit_capture_); |
+ |
+ rtc::scoped_ptr<TransientSuppressor> transient_suppressor_ |
+ GUARDED_BY(crit_capture_); |
+ const bool beamformer_enabled_ GUARDED_BY(crit_capture_); |
+ rtc::scoped_ptr<Beamformer<float>> beamformer_ GUARDED_BY(crit_capture_); |
+ const std::vector<Point> array_geometry_ GUARDED_BY(crit_render_) |
+ GUARDED_BY(crit_capture_); |
bool intelligibility_enabled_; |
rtc::scoped_ptr<IntelligibilityEnhancer> intelligibility_enhancer_; |