Add API for disabling the high pass filter.
BUG=issue419 TEST=manually with voe_cmd_test Review URL: https://webrtc-codereview.appspot.com/509003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2105 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
48a5df6481
commit
369166a179
@ -292,8 +292,8 @@ int AudioProcessingImpl::ProcessStream(AudioFrame* frame) {
|
||||
frame->_audioChannel = num_output_channels_;
|
||||
}
|
||||
|
||||
bool data_changed = stream_data_changed();
|
||||
if (analysis_needed(data_changed)) {
|
||||
bool data_processed = is_data_processed();
|
||||
if (analysis_needed(data_processed)) {
|
||||
for (int i = 0; i < num_output_channels_; i++) {
|
||||
// Split into a low and high band.
|
||||
SplittingFilterAnalysis(capture_audio_->data(i),
|
||||
@ -344,7 +344,7 @@ int AudioProcessingImpl::ProcessStream(AudioFrame* frame) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (synthesis_needed(data_changed)) {
|
||||
if (synthesis_needed(data_processed)) {
|
||||
for (int i = 0; i < num_output_channels_; i++) {
|
||||
// Recombine low and high bands.
|
||||
SplittingFilterSynthesis(capture_audio_->low_pass_split_data(i),
|
||||
@ -361,7 +361,7 @@ int AudioProcessingImpl::ProcessStream(AudioFrame* frame) {
|
||||
return err;
|
||||
}
|
||||
|
||||
capture_audio_->InterleaveTo(frame, data_changed);
|
||||
capture_audio_->InterleaveTo(frame, interleave_needed(data_processed));
|
||||
|
||||
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
||||
if (debug_file_->Open()) {
|
||||
@ -567,7 +567,7 @@ WebRtc_Word32 AudioProcessingImpl::ChangeUniqueId(const WebRtc_Word32 id) {
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
bool AudioProcessingImpl::stream_data_changed() const {
|
||||
bool AudioProcessingImpl::is_data_processed() const {
|
||||
int enabled_count = 0;
|
||||
std::list<ProcessingComponent*>::const_iterator it;
|
||||
for (it = component_list_.begin(); it != component_list_.end(); it++) {
|
||||
@ -592,12 +592,17 @@ bool AudioProcessingImpl::stream_data_changed() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioProcessingImpl::synthesis_needed(bool stream_data_changed) const {
|
||||
return (stream_data_changed && sample_rate_hz_ == kSampleRate32kHz);
|
||||
bool AudioProcessingImpl::interleave_needed(bool is_data_processed) const {
|
||||
// Check if we've upmixed or downmixed the audio.
|
||||
return (num_output_channels_ != num_input_channels_ || is_data_processed);
|
||||
}
|
||||
|
||||
bool AudioProcessingImpl::analysis_needed(bool stream_data_changed) const {
|
||||
if (!stream_data_changed && !voice_detection_->is_enabled()) {
|
||||
bool AudioProcessingImpl::synthesis_needed(bool is_data_processed) const {
|
||||
return (is_data_processed && sample_rate_hz_ == kSampleRate32kHz);
|
||||
}
|
||||
|
||||
bool AudioProcessingImpl::analysis_needed(bool is_data_processed) const {
|
||||
if (!is_data_processed && !voice_detection_->is_enabled()) {
|
||||
// Only level_estimator_ is enabled.
|
||||
return false;
|
||||
} else if (sample_rate_hz_ == kSampleRate32kHz) {
|
||||
|
@ -85,9 +85,10 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
|
||||
|
||||
private:
|
||||
bool stream_data_changed() const;
|
||||
bool synthesis_needed(bool stream_data_changed) const;
|
||||
bool analysis_needed(bool stream_data_changed) const;
|
||||
bool is_data_processed() const;
|
||||
bool interleave_needed(bool is_data_processed) const;
|
||||
bool synthesis_needed(bool is_data_processed) const;
|
||||
bool analysis_needed(bool is_data_processed) const;
|
||||
|
||||
int id_;
|
||||
|
||||
|
@ -112,6 +112,11 @@ public:
|
||||
// Gets settings for the AECM.
|
||||
virtual int GetAecmMode(AecmModes& mode, bool& enabledCNG) = 0;
|
||||
|
||||
// Enables a high pass filter on the capture signal. This removes DC bias
|
||||
// and low-frequency noise. Recommended to be enabled.
|
||||
virtual int EnableHighPassFilter(bool enable) = 0;
|
||||
virtual bool IsHighPassFilterEnabled() = 0;
|
||||
|
||||
// Sets status and mode of the receiving-side (Rx) NS.
|
||||
// The Rx NS reduces noise in the received signal for the specified
|
||||
// |channel|. Intended for advanced usage only.
|
||||
|
@ -734,6 +734,25 @@ int VoEAudioProcessingImpl::GetAecmMode(AecmModes& mode, bool& enabledCNG) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEAudioProcessingImpl::EnableHighPassFilter(bool enable) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"EnableHighPassFilter(%d)", enable);
|
||||
if (_shared->audio_processing()->high_pass_filter()->Enable(enable) !=
|
||||
AudioProcessing::kNoError) {
|
||||
_shared->SetLastError(VE_APM_ERROR, kTraceError,
|
||||
"HighPassFilter::Enable() failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool VoEAudioProcessingImpl::IsHighPassFilterEnabled() {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"IsHighPassFilterEnabled()");
|
||||
return _shared->audio_processing()->high_pass_filter()->is_enabled();
|
||||
}
|
||||
|
||||
int VoEAudioProcessingImpl::RegisterRxVadObserver(
|
||||
int channel,
|
||||
VoERxVadCallback& observer) {
|
||||
|
@ -65,6 +65,9 @@ class VoEAudioProcessingImpl
|
||||
|
||||
virtual int GetAecmMode(AecmModes& mode, bool& enabledCNG);
|
||||
|
||||
virtual int EnableHighPassFilter(bool enable);
|
||||
virtual bool IsHighPassFilterEnabled();
|
||||
|
||||
virtual int RegisterRxVadObserver(int channel,
|
||||
VoERxVadCallback& observer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user