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

Unified Diff: webrtc/modules/audio_processing/level_estimator_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: Created a threadsafe wrapper for the random generator in the locktest. Fixed an unprotected variabl… 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/level_estimator_impl.cc
diff --git a/webrtc/modules/audio_processing/level_estimator_impl.cc b/webrtc/modules/audio_processing/level_estimator_impl.cc
index 35fe697c2d6defc1af1f16b556239d7c174e5c46..52f6697a57e44c79765d53ee0ff0d82375ecfb8f 100644
--- a/webrtc/modules/audio_processing/level_estimator_impl.cc
+++ b/webrtc/modules/audio_processing/level_estimator_impl.cc
@@ -18,13 +18,17 @@
namespace webrtc {
LevelEstimatorImpl::LevelEstimatorImpl(const AudioProcessing* apm,
- CriticalSectionWrapper* crit)
- : ProcessingComponent(),
- crit_(crit) {}
+ rtc::CriticalSection* crit)
+ : ProcessingComponent(), crit_(crit) {
+ RTC_DCHECK(apm);
+ RTC_DCHECK(crit);
+}
LevelEstimatorImpl::~LevelEstimatorImpl() {}
int LevelEstimatorImpl::ProcessStream(AudioBuffer* audio) {
+ rtc::CritScope cs(crit_);
+
if (!is_component_enabled()) {
return AudioProcessing::kNoError;
}
@@ -39,15 +43,17 @@ int LevelEstimatorImpl::ProcessStream(AudioBuffer* audio) {
}
int LevelEstimatorImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(crit_);
+ rtc::CritScope cs(crit_);
return EnableComponent(enable);
}
bool LevelEstimatorImpl::is_enabled() const {
+ rtc::CritScope cs(crit_);
return is_component_enabled();
}
int LevelEstimatorImpl::RMS() {
+ rtc::CritScope cs(crit_);
if (!is_component_enabled()) {
return AudioProcessing::kNotEnabledError;
}
@@ -67,6 +73,7 @@ void LevelEstimatorImpl::DestroyHandle(void* handle) const {
}
int LevelEstimatorImpl::InitializeHandle(void* handle) const {
+ rtc::CritScope cs(crit_);
static_cast<RMSLevel*>(handle)->Reset();
return AudioProcessing::kNoError;
}
« no previous file with comments | « webrtc/modules/audio_processing/level_estimator_impl.h ('k') | webrtc/modules/audio_processing/noise_suppression_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698