Remove ProcessingComponent's dependence on AudioProcessingImpl.
- Move needed accessors to AudioProcessing. - Inject the crit directly as a dependency. - Remove the now unneeded EchoCancellationImplWrapper. BUG=2894 R=aluebs@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9199004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5620 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -13,10 +13,8 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/common_audio/vad/include/webrtc_vad.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
|
||||
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
||||
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -39,9 +37,11 @@ int MapSetting(VoiceDetection::Likelihood likelihood) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
VoiceDetectionImpl::VoiceDetectionImpl(const AudioProcessingImpl* apm)
|
||||
: ProcessingComponent(apm),
|
||||
VoiceDetectionImpl::VoiceDetectionImpl(const AudioProcessing* apm,
|
||||
CriticalSectionWrapper* crit)
|
||||
: ProcessingComponent(),
|
||||
apm_(apm),
|
||||
crit_(crit),
|
||||
stream_has_voice_(false),
|
||||
using_external_vad_(false),
|
||||
likelihood_(kLowLikelihood),
|
||||
@ -87,7 +87,7 @@ int VoiceDetectionImpl::ProcessCaptureAudio(AudioBuffer* audio) {
|
||||
}
|
||||
|
||||
int VoiceDetectionImpl::Enable(bool enable) {
|
||||
CriticalSectionScoped crit_scoped(apm_->crit());
|
||||
CriticalSectionScoped crit_scoped(crit_);
|
||||
return EnableComponent(enable);
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ bool VoiceDetectionImpl::stream_has_voice() const {
|
||||
}
|
||||
|
||||
int VoiceDetectionImpl::set_likelihood(VoiceDetection::Likelihood likelihood) {
|
||||
CriticalSectionScoped crit_scoped(apm_->crit());
|
||||
CriticalSectionScoped crit_scoped(crit_);
|
||||
if (MapSetting(likelihood) == -1) {
|
||||
return apm_->kBadParameterError;
|
||||
}
|
||||
@ -122,7 +122,7 @@ VoiceDetection::Likelihood VoiceDetectionImpl::likelihood() const {
|
||||
}
|
||||
|
||||
int VoiceDetectionImpl::set_frame_size_ms(int size) {
|
||||
CriticalSectionScoped crit_scoped(apm_->crit());
|
||||
CriticalSectionScoped crit_scoped(crit_);
|
||||
assert(size == 10); // TODO(ajm): remove when supported.
|
||||
if (size != 10 &&
|
||||
size != 20 &&
|
||||
|
||||
Reference in New Issue
Block a user