Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: webrtc/modules/audio_processing/high_pass_filter_impl.cc

Issue 1424663003: Lock scheme #8: Introduced the new locking scheme (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@add_threadcheckers_CL
Patch Set: Fixed a bad merge error for the beamformer settings and updated with the latest merge from master Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/high_pass_filter_impl.cc
diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc
index 29e482078e9438ba6a0397986ca1c702e865e0ca..8de2162175ca762f502f91ff83188b2cf79a1789 100644
--- a/webrtc/modules/audio_processing/high_pass_filter_impl.cc
+++ b/webrtc/modules/audio_processing/high_pass_filter_impl.cc
@@ -100,14 +100,14 @@ int Filter(FilterState* hpf, int16_t* data, size_t length) {
typedef FilterState Handle;
HighPassFilterImpl::HighPassFilterImpl(const AudioProcessing* apm,
- CriticalSectionWrapper* crit)
- : ProcessingComponent(),
- apm_(apm),
- crit_(crit) {}
+ rtc::CriticalSection* crit)
+ : ProcessingComponent(), apm_(apm), crit_(crit) {}
HighPassFilterImpl::~HighPassFilterImpl() {}
int HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) {
+ // This function is only called from within APM and does not/cannot
+ // take a lock.
int err = apm_->kNoError;
if (!is_component_enabled()) {
@@ -131,11 +131,12 @@ int HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
int HighPassFilterImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(crit_);
+ rtc::CritScope cs(crit_);
return EnableComponent(enable);
}
bool HighPassFilterImpl::is_enabled() const {
+ rtc::CritScope cs(crit_);
return is_component_enabled();
}
@@ -148,6 +149,8 @@ void HighPassFilterImpl::DestroyHandle(void* handle) const {
}
int HighPassFilterImpl::InitializeHandle(void* handle) const {
+ // TODO(peah): Remove dependency on apm for the
+ // capture side sample rate.
return InitializeFilter(static_cast<Handle*>(handle),
apm_->proc_sample_rate_hz());
}

Powered by Google App Engine
This is Rietveld 408576698