| Index: webrtc/modules/audio_processing/voice_detection_impl.cc
|
| diff --git a/webrtc/modules/audio_processing/voice_detection_impl.cc b/webrtc/modules/audio_processing/voice_detection_impl.cc
|
| index 7cee1837ba1e807bc636784c79368c8e1d195b4e..862c3028638fae57b6d6b0c616e91e5da9638669 100644
|
| --- a/webrtc/modules/audio_processing/voice_detection_impl.cc
|
| +++ b/webrtc/modules/audio_processing/voice_detection_impl.cc
|
| @@ -12,9 +12,9 @@
|
|
|
| #include <assert.h>
|
|
|
| +#include "webrtc/base/criticalsection.h"
|
| #include "webrtc/common_audio/vad/include/webrtc_vad.h"
|
| #include "webrtc/modules/audio_processing/audio_buffer.h"
|
| -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
|
|
| namespace webrtc {
|
|
|
| @@ -38,7 +38,7 @@ int MapSetting(VoiceDetection::Likelihood likelihood) {
|
| } // namespace
|
|
|
| VoiceDetectionImpl::VoiceDetectionImpl(const AudioProcessing* apm,
|
| - CriticalSectionWrapper* crit,
|
| + rtc::CriticalSection* crit,
|
| rtc::ThreadChecker* capture_thread)
|
| : ProcessingComponent(),
|
| apm_(apm),
|
| @@ -84,28 +84,31 @@ int VoiceDetectionImpl::ProcessCaptureAudio(AudioBuffer* audio) {
|
| }
|
|
|
| int VoiceDetectionImpl::Enable(bool enable) {
|
| - CriticalSectionScoped crit_scoped(crit_);
|
| + rtc::CritScope cs(crit_);
|
| return EnableComponent(enable);
|
| }
|
|
|
| bool VoiceDetectionImpl::is_enabled() const {
|
| + rtc::CritScope cs(crit_);
|
| return is_component_enabled();
|
| }
|
|
|
| int VoiceDetectionImpl::set_stream_has_voice(bool has_voice) {
|
| + rtc::CritScope cs(crit_);
|
| using_external_vad_ = true;
|
| stream_has_voice_ = has_voice;
|
| return apm_->kNoError;
|
| }
|
|
|
| bool VoiceDetectionImpl::stream_has_voice() const {
|
| + rtc::CritScope cs(crit_);
|
| // TODO(ajm): enable this assertion?
|
| //assert(using_external_vad_ || is_component_enabled());
|
| return stream_has_voice_;
|
| }
|
|
|
| int VoiceDetectionImpl::set_likelihood(VoiceDetection::Likelihood likelihood) {
|
| - CriticalSectionScoped crit_scoped(crit_);
|
| + rtc::CritScope cs(crit_);
|
| if (MapSetting(likelihood) == -1) {
|
| return apm_->kBadParameterError;
|
| }
|
| @@ -115,11 +118,12 @@ int VoiceDetectionImpl::set_likelihood(VoiceDetection::Likelihood likelihood) {
|
| }
|
|
|
| VoiceDetection::Likelihood VoiceDetectionImpl::likelihood() const {
|
| + rtc::CritScope cs(crit_);
|
| return likelihood_;
|
| }
|
|
|
| int VoiceDetectionImpl::set_frame_size_ms(int size) {
|
| - CriticalSectionScoped crit_scoped(crit_);
|
| + rtc::CritScope cs(crit_);
|
| assert(size == 10); // TODO(ajm): remove when supported.
|
| if (size != 10 &&
|
| size != 20 &&
|
| @@ -133,6 +137,7 @@ int VoiceDetectionImpl::set_frame_size_ms(int size) {
|
| }
|
|
|
| int VoiceDetectionImpl::frame_size_ms() const {
|
| + rtc::CritScope cs(crit_);
|
| return frame_size_ms_;
|
| }
|
|
|
|
|