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
This commit is contained in:
andrew@webrtc.org 2012-01-30 20:51:15 +00:00
parent 7ca9925068
commit 40654039cd
8 changed files with 36 additions and 36 deletions

View File

@ -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::split_sample_rate_hz() const {
}
int AudioProcessingImpl::Initialize() {
CriticalSectionScoped crit_scoped(*crit_);
CriticalSectionScoped crit_scoped(crit_);
return InitializeLocked();
}
@ -183,7 +183,7 @@ int AudioProcessingImpl::InitializeLocked() {
}
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::sample_rate_hz() const {
}
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::num_reverse_channels() const {
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::num_output_channels() const {
}
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::ProcessStream(AudioFrame* frame) {
}
int AudioProcessingImpl::AnalyzeReverseStream(AudioFrame* frame) {
CriticalSectionScoped crit_scoped(*crit_);
CriticalSectionScoped crit_scoped(crit_);
int err = kNoError;
if (frame == NULL) {
@ -478,7 +478,7 @@ bool AudioProcessingImpl::was_stream_delay_set() const {
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::StartDebugRecording(
}
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 @@ VoiceDetection* AudioProcessingImpl::voice_detection() const {
}
WebRtc_Word32 AudioProcessingImpl::ChangeUniqueId(const WebRtc_Word32 id) {
CriticalSectionScoped crit_scoped(*crit_);
CriticalSectionScoped crit_scoped(crit_);
/*WEBRTC_TRACE(webrtc::kTraceModuleCall,
webrtc::kTraceAudioProcessing,
id_,

View File

@ -163,7 +163,7 @@ int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
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 @@ bool EchoCancellationImpl::is_enabled() const {
}
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 @@ EchoCancellation::SuppressionLevel EchoCancellationImpl::suppression_level()
}
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 @@ bool EchoCancellationImpl::is_drift_compensation_enabled() const {
}
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::stream_drift_samples() const {
}
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 @@ bool EchoCancellationImpl::are_metrics_enabled() const {
// 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 @@ bool EchoCancellationImpl::stream_has_echo() const {
}
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 @@ bool EchoCancellationImpl::is_delay_logging_enabled() const {
// 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;
}

View File

@ -155,7 +155,7 @@ int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
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 @@ bool EchoControlMobileImpl::is_enabled() const {
}
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 @@ EchoControlMobile::RoutingMode EchoControlMobileImpl::routing_mode()
}
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 @@ bool EchoControlMobileImpl::is_comfort_noise_enabled() const {
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::SetEchoPath(const void* echo_path,
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;
}

View File

@ -226,7 +226,7 @@ int GainControlImpl::stream_analog_level() {
}
int GainControlImpl::Enable(bool enable) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
@ -235,7 +235,7 @@ bool GainControlImpl::is_enabled() const {
}
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 @@ GainControl::Mode GainControlImpl::mode() const {
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 @@ bool GainControlImpl::stream_is_saturated() const {
}
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::target_level_dbfs() const {
}
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::compression_gain_db() const {
}
int GainControlImpl::enable_limiter(bool enable) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
limiter_enabled_ = enable;
return Configure();
}

View File

@ -135,7 +135,7 @@ int HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
int HighPassFilterImpl::Enable(bool enable) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}

View File

@ -113,7 +113,7 @@ int LevelEstimatorImpl::ProcessStream(AudioBuffer* audio) {
}
int LevelEstimatorImpl::Enable(bool enable) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}

View File

@ -88,7 +88,7 @@ int NoiseSuppressionImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
int NoiseSuppressionImpl::Enable(bool enable) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
@ -97,7 +97,7 @@ bool NoiseSuppressionImpl::is_enabled() const {
}
int NoiseSuppressionImpl::set_level(Level level) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
if (MapSetting(level) == -1) {
return apm_->kBadParameterError;
}

View File

@ -92,7 +92,7 @@ int VoiceDetectionImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
int VoiceDetectionImpl::Enable(bool enable) {
CriticalSectionScoped crit_scoped(*apm_->crit());
CriticalSectionScoped crit_scoped(apm_->crit());
return EnableComponent(enable);
}
@ -113,7 +113,7 @@ bool VoiceDetectionImpl::stream_has_voice() const {
}
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 @@ VoiceDetection::Likelihood VoiceDetectionImpl::likelihood() const {
}
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 &&