Introduced the new locking scheme

BUG=webrtc:5099

Review URL: https://codereview.webrtc.org/1424663003

Cr-Commit-Position: refs/heads/master@{#10836}
This commit is contained in:
peah
2015-11-28 12:35:15 -08:00
committed by Commit bot
parent 3236b91f55
commit df3efa8c07
17 changed files with 1304 additions and 836 deletions

View File

@ -11,18 +11,18 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_
#include "webrtc/base/criticalsection.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/processing_component.h"
namespace webrtc {
class AudioBuffer;
class CriticalSectionWrapper;
class VoiceDetectionImpl : public VoiceDetection,
public ProcessingComponent {
public:
VoiceDetectionImpl(const AudioProcessing* apm, CriticalSectionWrapper* crit);
VoiceDetectionImpl(const AudioProcessing* apm, rtc::CriticalSection* crit);
virtual ~VoiceDetectionImpl();
int ProcessCaptureAudio(AudioBuffer* audio);
@ -51,13 +51,16 @@ class VoiceDetectionImpl : public VoiceDetection,
int num_handles_required() const override;
int GetHandleError(void* handle) const override;
// Not guarded as its public API is thread safe.
const AudioProcessing* apm_;
CriticalSectionWrapper* crit_;
bool stream_has_voice_;
bool using_external_vad_;
Likelihood likelihood_;
int frame_size_ms_;
size_t frame_size_samples_;
rtc::CriticalSection* const crit_;
bool stream_has_voice_ GUARDED_BY(crit_);
bool using_external_vad_ GUARDED_BY(crit_);
Likelihood likelihood_ GUARDED_BY(crit_);
int frame_size_ms_ GUARDED_BY(crit_);
size_t frame_size_samples_ GUARDED_BY(crit_);
};
} // namespace webrtc