Use pointer-based CriticalSectionScoped().
The reference-based constructor is deprecated.
BUG=185
TEST=audioproc_unittest
Review URL: https://webrtc-codereview.appspot.com/373015
git-svn-id: http://webrtc.googlecode.com/svn/trunk@1573 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/audio_processing/audio_processing_impl.cc b/src/modules/audio_processing/audio_processing_impl.cc
index 9702e9e..b0974be 100644
--- a/src/modules/audio_processing/audio_processing_impl.cc
+++ b/src/modules/audio_processing/audio_processing_impl.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -139,7 +139,7 @@
}
int AudioProcessingImpl::Initialize() {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
return InitializeLocked();
}
@@ -183,7 +183,7 @@
}
int AudioProcessingImpl::set_sample_rate_hz(int rate) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
if (rate != kSampleRate8kHz &&
rate != kSampleRate16kHz &&
rate != kSampleRate32kHz) {
@@ -207,7 +207,7 @@
}
int AudioProcessingImpl::set_num_reverse_channels(int channels) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
// Only stereo supported currently.
if (channels > 2 || channels < 1) {
return kBadParameterError;
@@ -225,7 +225,7 @@
int AudioProcessingImpl::set_num_channels(
int input_channels,
int output_channels) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
if (output_channels > input_channels) {
return kBadParameterError;
}
@@ -254,7 +254,7 @@
}
int AudioProcessingImpl::ProcessStream(AudioFrame* frame) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
int err = kNoError;
if (frame == NULL) {
@@ -385,7 +385,7 @@
}
int AudioProcessingImpl::AnalyzeReverseStream(AudioFrame* frame) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
int err = kNoError;
if (frame == NULL) {
@@ -478,7 +478,7 @@
int AudioProcessingImpl::StartDebugRecording(
const char filename[AudioProcessing::kMaxFilenameSize]) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
assert(kMaxFilenameSize == FileWrapper::kMaxFileNameSize);
if (filename == NULL) {
@@ -509,7 +509,7 @@
}
int AudioProcessingImpl::StopDebugRecording() {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
// We just return if recording hasn't started.
@@ -553,7 +553,7 @@
}
WebRtc_Word32 AudioProcessingImpl::ChangeUniqueId(const WebRtc_Word32 id) {
- CriticalSectionScoped crit_scoped(*crit_);
+ CriticalSectionScoped crit_scoped(crit_);
/*WEBRTC_TRACE(webrtc::kTraceModuleCall,
webrtc::kTraceAudioProcessing,
id_,
diff --git a/src/modules/audio_processing/echo_cancellation_impl.cc b/src/modules/audio_processing/echo_cancellation_impl.cc
index 355f396..9f2cd73 100644
--- a/src/modules/audio_processing/echo_cancellation_impl.cc
+++ b/src/modules/audio_processing/echo_cancellation_impl.cc
@@ -163,7 +163,7 @@
}
int EchoCancellationImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
// Ensure AEC and AECM are not both enabled.
if (enable && apm_->echo_control_mobile()->is_enabled()) {
return apm_->kBadParameterError;
@@ -177,7 +177,7 @@
}
int EchoCancellationImpl::set_suppression_level(SuppressionLevel level) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (MapSetting(level) == -1) {
return apm_->kBadParameterError;
}
@@ -192,7 +192,7 @@
}
int EchoCancellationImpl::enable_drift_compensation(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
drift_compensation_enabled_ = enable;
return Configure();
}
@@ -202,7 +202,7 @@
}
int EchoCancellationImpl::set_device_sample_rate_hz(int rate) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (rate < 8000 || rate > 96000) {
return apm_->kBadParameterError;
}
@@ -226,7 +226,7 @@
}
int EchoCancellationImpl::enable_metrics(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
metrics_enabled_ = enable;
return Configure();
}
@@ -238,7 +238,7 @@
// TODO(ajm): we currently just use the metrics from the first AEC. Think more
// aboue the best way to extend this to multi-channel.
int EchoCancellationImpl::GetMetrics(Metrics* metrics) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (metrics == NULL) {
return apm_->kNullPointerError;
}
@@ -285,7 +285,7 @@
}
int EchoCancellationImpl::enable_delay_logging(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
delay_logging_enabled_ = enable;
return Configure();
}
@@ -296,7 +296,7 @@
// TODO(bjornv): How should we handle the multi-channel case?
int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (median == NULL) {
return apm_->kNullPointerError;
}
diff --git a/src/modules/audio_processing/echo_control_mobile_impl.cc b/src/modules/audio_processing/echo_control_mobile_impl.cc
index 6e3449d..20ca0ad 100644
--- a/src/modules/audio_processing/echo_control_mobile_impl.cc
+++ b/src/modules/audio_processing/echo_control_mobile_impl.cc
@@ -155,7 +155,7 @@
}
int EchoControlMobileImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
// Ensure AEC and AECM are not both enabled.
if (enable && apm_->echo_cancellation()->is_enabled()) {
return apm_->kBadParameterError;
@@ -169,7 +169,7 @@
}
int EchoControlMobileImpl::set_routing_mode(RoutingMode mode) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (MapSetting(mode) == -1) {
return apm_->kBadParameterError;
}
@@ -184,7 +184,7 @@
}
int EchoControlMobileImpl::enable_comfort_noise(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
comfort_noise_enabled_ = enable;
return Configure();
}
@@ -195,7 +195,7 @@
int EchoControlMobileImpl::SetEchoPath(const void* echo_path,
size_t size_bytes) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (echo_path == NULL) {
return apm_->kNullPointerError;
}
@@ -214,7 +214,7 @@
int EchoControlMobileImpl::GetEchoPath(void* echo_path,
size_t size_bytes) const {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (echo_path == NULL) {
return apm_->kNullPointerError;
}
diff --git a/src/modules/audio_processing/gain_control_impl.cc b/src/modules/audio_processing/gain_control_impl.cc
index c3292d6..0cbd736 100644
--- a/src/modules/audio_processing/gain_control_impl.cc
+++ b/src/modules/audio_processing/gain_control_impl.cc
@@ -226,7 +226,7 @@
}
int GainControlImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
@@ -235,7 +235,7 @@
}
int GainControlImpl::set_mode(Mode mode) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (MapSetting(mode) == -1) {
return apm_->kBadParameterError;
}
@@ -250,7 +250,7 @@
int GainControlImpl::set_analog_level_limits(int minimum,
int maximum) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (minimum < 0) {
return apm_->kBadParameterError;
}
@@ -282,7 +282,7 @@
}
int GainControlImpl::set_target_level_dbfs(int level) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (level > 31 || level < 0) {
return apm_->kBadParameterError;
}
@@ -296,7 +296,7 @@
}
int GainControlImpl::set_compression_gain_db(int gain) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (gain < 0 || gain > 90) {
return apm_->kBadParameterError;
}
@@ -310,7 +310,7 @@
}
int GainControlImpl::enable_limiter(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
limiter_enabled_ = enable;
return Configure();
}
diff --git a/src/modules/audio_processing/high_pass_filter_impl.cc b/src/modules/audio_processing/high_pass_filter_impl.cc
index a50da41..b20fed8 100644
--- a/src/modules/audio_processing/high_pass_filter_impl.cc
+++ b/src/modules/audio_processing/high_pass_filter_impl.cc
@@ -135,7 +135,7 @@
}
int HighPassFilterImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
diff --git a/src/modules/audio_processing/level_estimator_impl.cc b/src/modules/audio_processing/level_estimator_impl.cc
index 24f7718..42cac99 100644
--- a/src/modules/audio_processing/level_estimator_impl.cc
+++ b/src/modules/audio_processing/level_estimator_impl.cc
@@ -113,7 +113,7 @@
}
int LevelEstimatorImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
diff --git a/src/modules/audio_processing/noise_suppression_impl.cc b/src/modules/audio_processing/noise_suppression_impl.cc
index 3c7203c..9c81b5d 100644
--- a/src/modules/audio_processing/noise_suppression_impl.cc
+++ b/src/modules/audio_processing/noise_suppression_impl.cc
@@ -88,7 +88,7 @@
}
int NoiseSuppressionImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
@@ -97,7 +97,7 @@
}
int NoiseSuppressionImpl::set_level(Level level) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (MapSetting(level) == -1) {
return apm_->kBadParameterError;
}
diff --git a/src/modules/audio_processing/voice_detection_impl.cc b/src/modules/audio_processing/voice_detection_impl.cc
index e248171..ecada4a 100644
--- a/src/modules/audio_processing/voice_detection_impl.cc
+++ b/src/modules/audio_processing/voice_detection_impl.cc
@@ -92,7 +92,7 @@
}
int VoiceDetectionImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
@@ -113,7 +113,7 @@
}
int VoiceDetectionImpl::set_likelihood(VoiceDetection::Likelihood likelihood) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
if (MapSetting(likelihood) == -1) {
return apm_->kBadParameterError;
}
@@ -127,7 +127,7 @@
}
int VoiceDetectionImpl::set_frame_size_ms(int size) {
- CriticalSectionScoped crit_scoped(*apm_->crit());
+ CriticalSectionScoped crit_scoped(apm_->crit());
assert(size == 10); // TODO(ajm): remove when supported.
if (size != 10 &&
size != 20 &&