| Index: webrtc/modules/audio_processing/test/audio_processing_simulator.cc
|
| diff --git a/webrtc/modules/audio_processing/test/audio_processing_simulator.cc b/webrtc/modules/audio_processing/test/audio_processing_simulator.cc
|
| index 2f8c75094e144f510dede9d697e095f98e1fdfcd..1f7ff47d38d50fffc76a2ed50d41255e0584e1f0 100644
|
| --- a/webrtc/modules/audio_processing/test/audio_processing_simulator.cc
|
| +++ b/webrtc/modules/audio_processing/test/audio_processing_simulator.cc
|
| @@ -80,6 +80,11 @@ void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest) {
|
| AudioProcessingSimulator::AudioProcessingSimulator(
|
| const SimulationSettings& settings)
|
| : settings_(settings) {
|
| + if (settings_.simulate_mic_gain) {
|
| + fake_recording_device_.emplace(
|
| + static_cast<FakeRecordingDevice::LevelToScalingMappingKind>(
|
| + *settings_.simulated_mic_kind));
|
| + }
|
| if (settings_.ed_graph_output_filename &&
|
| settings_.ed_graph_output_filename->size() > 0) {
|
| residual_echo_likelihood_graph_writer_.open(
|
| @@ -107,15 +112,26 @@ void AudioProcessingSimulator::ProcessStream(bool fixed_interface) {
|
| if (fixed_interface) {
|
| {
|
| const auto st = ScopedTimer(mutable_proc_time());
|
| - // TODO(alessiob): Change fwd_frame_ simulating a mic with analog gain and
|
| - // an application gain.
|
| + if (fake_recording_device_) {
|
| + fake_recording_device_->ProcessStream(&fwd_frame_, &fwd_frame_);
|
| + }
|
| RTC_CHECK_EQ(AudioProcessing::kNoError, ap_->ProcessStream(&fwd_frame_));
|
| }
|
| CopyFromAudioFrame(fwd_frame_, out_buf_.get());
|
| } else {
|
| const auto st = ScopedTimer(mutable_proc_time());
|
| - // TODO(alessiob): Change in_buf_->channels() simulating a mic with analog
|
| - // gain and an application gain.
|
| + if (fake_recording_device_) {
|
| + const size_t channel_size = in_config_.num_frames();
|
| +
|
| + std::vector<rtc::ArrayView<const float>> data_view;
|
| + std::vector<rtc::ArrayView<float>> after_scaling_view;
|
| + for (size_t i = 0; i < in_config_.num_channels(); ++i) {
|
| + data_view.emplace_back(in_buf_->channels()[i], channel_size);
|
| + after_scaling_view.emplace_back(in_buf_->channels()[i], channel_size);
|
| + }
|
| +
|
| + fake_recording_device_->ProcessStream(data_view, after_scaling_view);
|
| + }
|
| RTC_CHECK_EQ(AudioProcessing::kNoError,
|
| ap_->ProcessStream(in_buf_->channels(), in_config_,
|
| out_config_, out_buf_->channels()));
|
|
|