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 d2c274f460010af7976fc2a2f1032c8bb72ecc8a..0d5493d89ec5d0dc8e5ca1d4bef340ce550dadaf 100644 |
--- a/webrtc/modules/audio_processing/test/audio_processing_simulator.cc |
+++ b/webrtc/modules/audio_processing/test/audio_processing_simulator.cc |
@@ -14,6 +14,7 @@ |
#include <iostream> |
#include <sstream> |
#include <string> |
+#include <utility> |
#include <vector> |
#include "webrtc/base/checks.h" |
@@ -102,19 +103,36 @@ AudioProcessingSimulator::ScopedTimer::~ScopedTimer() { |
proc_time_->min = std::min(proc_time_->min, interval); |
} |
-void AudioProcessingSimulator::ProcessStream(bool fixed_interface) { |
+void AudioProcessingSimulator::ProcessStream(bool fixed_interface, |
+ bool update_analog_level) { |
peah-webrtc
2017/04/26 12:54:44
I think the naming of the update_analog_level coul
|
+ if (update_analog_level) { |
+ RTC_CHECK_EQ(AudioProcessing::kNoError, |
+ ap_->gain_control()->set_stream_analog_level( |
+ last_specified_microphone_level_)); |
+ } |
if (fixed_interface) { |
{ |
const auto st = ScopedTimer(mutable_proc_time()); |
+ // TODO(alessiob): Apply last_specified_microphone_level_ to fwd_frame_ |
peah-webrtc
2017/04/26 12:54:44
I think the approach to apply the microphone level
|
+ // simulating a mic with analog gain. |
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): Apply last_specified_microphone_level_ to |
+ // in_buf_->channels() simulating a mic with analog gain. |
RTC_CHECK_EQ(AudioProcessing::kNoError, |
ap_->ProcessStream(in_buf_->channels(), in_config_, |
out_config_, out_buf_->channels())); |
} |
+ // Update last_specified_microphone_level_ using the value suggested by AGC |
peah-webrtc
2017/04/26 12:54:44
the AGC
|
+ // or the default if settings_.simulate_mic_gain is false. |
+ if (update_analog_level) { |
+ last_specified_microphone_level_ = settings_.simulate_mic_gain ? |
hlundin-webrtc
2017/04/26 12:11:37
This is confusing. If update_analog_level is true,
peah-webrtc
2017/04/26 12:54:44
This is not correct. If you don't simulate the mic
|
+ ap_->gain_control()->stream_analog_level() |
+ : kInitialMicrophoneGainLevel; |
+ } |
if (buffer_writer_) { |
buffer_writer_->Write(*out_buf_); |