Chromium Code Reviews| Index: webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc |
| diff --git a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc |
| index d1cd48424a1cfcb3708c170f2a1a91d866f35887..fe1327b28a7f2677dd10d74f765ebf5c1c23a169 100644 |
| --- a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc |
| +++ b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc |
| @@ -8,7 +8,9 @@ |
| * be found in the AUTHORS file in the root of the source tree. |
| */ |
| +#include <algorithm> |
| #include <iostream> |
| +#include <utility> |
| #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h" |
| @@ -69,7 +71,7 @@ AecDumpBasedSimulator::~AecDumpBasedSimulator() = default; |
| void AecDumpBasedSimulator::PrepareProcessStreamCall( |
| const webrtc::audioproc::Stream& msg, |
| - bool* set_stream_analog_level_called) { |
| + bool* update_analog_level) { |
| if (msg.has_input_data()) { |
| // Fixed interface processing. |
| // Verify interface invariance. |
| @@ -158,12 +160,16 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall( |
| // TODO(peah): Add support for controlling the analog level via the |
| // command-line. |
| - if (msg.has_level()) { |
| - RTC_CHECK_EQ(AudioProcessing::kNoError, |
| - ap_->gain_control()->set_stream_analog_level(msg.level())); |
| - *set_stream_analog_level_called = true; |
| - } else { |
| - *set_stream_analog_level_called = false; |
| + // If the AECdump does not include a level, AGC was disabled during the call. |
|
peah-webrtc
2017/04/26 12:54:44
No, I don't think it works like this. msg.has_leve
aleloi
2017/05/04 12:47:13
I just checked, msg->set_level(gain_control()->str
|
| + // If so and if the analog gain simulation is disabled, inform |
| + // AudioProcessingSimulator::ProcessStream in order not to call |
| + // GainControl::set_stream_analog_level() and |
| + // GainControl::stream_analog_level() before and after |
| + // AudioProcessing::ProcessStream respectively. |
| + *update_analog_level = msg.has_level() || settings_.simulate_mic_gain; |
| + if (!settings_.simulate_mic_gain && msg.has_level()) { |
| + // The analog gain simulation is off, use the level stored in the AECdump. |
| + last_specified_microphone_level_ = msg.level(); |
|
peah-webrtc
2017/04/26 12:54:44
I think this CL would be easier to review with an
peah-webrtc
2017/04/26 12:54:44
I think the name last_specified_microphone_level_
aleloi
2017/05/04 12:47:13
Acknowledged.
|
| } |
| } |
| @@ -562,14 +568,10 @@ void AecDumpBasedSimulator::HandleMessage(const webrtc::audioproc::Init& msg) { |
| void AecDumpBasedSimulator::HandleMessage( |
| const webrtc::audioproc::Stream& msg) { |
| - bool set_stream_analog_level_called = false; |
| - PrepareProcessStreamCall(msg, &set_stream_analog_level_called); |
| - ProcessStream(interface_used_ == InterfaceType::kFixedInterface); |
| - if (set_stream_analog_level_called) { |
| - // Call stream analog level to ensure that any side-effects are triggered. |
| - (void)ap_->gain_control()->stream_analog_level(); |
| - } |
| - |
| + bool update_analog_level = true; |
| + PrepareProcessStreamCall(msg, &update_analog_level); |
|
aleloi
2017/05/04 12:47:13
I think update_analog_level should be renamed in t
|
| + ProcessStream(interface_used_ == InterfaceType::kFixedInterface, |
| + update_analog_level); |
| VerifyProcessStreamBitExactness(msg); |
| } |