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

Unified Diff: webrtc/modules/audio_processing/noise_suppression_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 5 years, 2 months 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/noise_suppression_impl.cc
diff --git a/webrtc/modules/audio_processing/noise_suppression_impl.cc b/webrtc/modules/audio_processing/noise_suppression_impl.cc
index 00198cf0602026f6c7e629397ca50ee77dc2b142..8f2f5bcbbe964c703c2ed009681bd9036e0080b0 100644
--- a/webrtc/modules/audio_processing/noise_suppression_impl.cc
+++ b/webrtc/modules/audio_processing/noise_suppression_impl.cc
@@ -12,13 +12,13 @@
#include <assert.h>
+#include "webrtc/base/criticalsection.h"
#include "webrtc/modules/audio_processing/audio_buffer.h"
#if defined(WEBRTC_NS_FLOAT)
#include "webrtc/modules/audio_processing/ns/include/noise_suppression.h"
#elif defined(WEBRTC_NS_FIXED)
#include "webrtc/modules/audio_processing/ns/include/noise_suppression_x.h"
#endif
-#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
namespace webrtc {
@@ -47,7 +47,7 @@ int MapSetting(NoiseSuppression::Level level) {
} // namespace
NoiseSuppressionImpl::NoiseSuppressionImpl(const AudioProcessing* apm,
- CriticalSectionWrapper* crit,
+ rtc::CriticalSection* crit,
rtc::ThreadChecker* capture_thread)
: ProcessingComponent(),
apm_(apm),
@@ -101,16 +101,17 @@ int NoiseSuppressionImpl::ProcessCaptureAudio(AudioBuffer* audio) {
}
int NoiseSuppressionImpl::Enable(bool enable) {
- CriticalSectionScoped crit_scoped(crit_);
+ rtc::CritScope cs(crit_);
return EnableComponent(enable);
}
bool NoiseSuppressionImpl::is_enabled() const {
+ rtc::CritScope cs(crit_);
return is_component_enabled();
}
int NoiseSuppressionImpl::set_level(Level level) {
- CriticalSectionScoped crit_scoped(crit_);
+ rtc::CritScope cs(crit_);
if (MapSetting(level) == -1) {
return apm_->kBadParameterError;
}
@@ -120,10 +121,12 @@ int NoiseSuppressionImpl::set_level(Level level) {
}
NoiseSuppression::Level NoiseSuppressionImpl::level() const {
+ rtc::CritScope cs(crit_);
return level_;
}
float NoiseSuppressionImpl::speech_probability() const {
+ rtc::CritScope cs(crit_);
#if defined(WEBRTC_NS_FLOAT)
float probability_average = 0.0f;
for (int i = 0; i < num_handles(); i++) {

Powered by Google App Engine
This is Rietveld 408576698