Index: webrtc/modules/audio_processing/audio_processing_impl.cc |
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc |
index 819a18b62d958f38e7b4a5f6b5f92687c8cf59bb..a7b0b98ef27a12d40408710f51158475830bf854 100644 |
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc |
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc |
@@ -127,10 +127,10 @@ struct AudioProcessingImpl::ApmPublicSubmodules { |
}; |
struct AudioProcessingImpl::ApmPrivateSubmodules { |
- explicit ApmPrivateSubmodules(Beamformer<float>* beamformer) |
+ explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer) |
: beamformer(beamformer) {} |
// Accessed internally from capture or during initialization |
- std::unique_ptr<Beamformer<float>> beamformer; |
+ std::unique_ptr<NonlinearBeamformer> beamformer; |
std::unique_ptr<AgcManagerDirect> agc_manager; |
}; |
@@ -144,7 +144,7 @@ AudioProcessing* AudioProcessing::Create(const Config& config) { |
} |
AudioProcessing* AudioProcessing::Create(const Config& config, |
- Beamformer<float>* beamformer) { |
+ NonlinearBeamformer* beamformer) { |
AudioProcessingImpl* apm = new AudioProcessingImpl(config, beamformer); |
if (apm->Initialize() != kNoError) { |
delete apm; |
@@ -158,7 +158,7 @@ AudioProcessingImpl::AudioProcessingImpl(const Config& config) |
: AudioProcessingImpl(config, nullptr) {} |
AudioProcessingImpl::AudioProcessingImpl(const Config& config, |
- Beamformer<float>* beamformer) |
+ NonlinearBeamformer* beamformer) |
: public_submodules_(new ApmPublicSubmodules()), |
private_submodules_(new ApmPrivateSubmodules(beamformer)), |
constants_(config.Get<ExperimentalAgc>().startup_min_volume, |
@@ -684,8 +684,8 @@ int AudioProcessingImpl::ProcessStreamLocked() { |
} |
if (capture_nonlocked_.beamformer_enabled) { |
- private_submodules_->beamformer->ProcessChunk(*ca->split_data_f(), |
- ca->split_data_f()); |
+ private_submodules_->beamformer->AnalyzeChunk(*ca->split_data_f()); |
+ // Discards all channels by the leftmost one. |
ca->set_num_channels(1); |
} |
@@ -727,6 +727,10 @@ int AudioProcessingImpl::ProcessStreamLocked() { |
RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessCaptureAudio( |
ca, stream_delay_ms())); |
+ if (capture_nonlocked_.beamformer_enabled) { |
+ private_submodules_->beamformer->PostFilter(ca->split_data_f()); |
+ } |
+ |
public_submodules_->voice_detection->ProcessCaptureAudio(ca); |
if (constants_.use_experimental_agc && |
@@ -1199,7 +1203,7 @@ void AudioProcessingImpl::InitializeBeamformer() { |
if (capture_nonlocked_.beamformer_enabled) { |
if (!private_submodules_->beamformer) { |
private_submodules_->beamformer.reset(new NonlinearBeamformer( |
- capture_.array_geometry, capture_.target_direction)); |
+ capture_.array_geometry, 1u, capture_.target_direction)); |
} |
private_submodules_->beamformer->Initialize(kChunkSizeMs, |
capture_nonlocked_.split_rate); |