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..09507ebfc0438a5bcc41c50d5dbac4e7c23e105f 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* skip_analog_level_update) { |
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. |
+ // If so and the analog gain simulation is disabled, inform |
aleloi
2017/04/21 11:52:29
If so and *if* the...
At least, I think so
AleBzk
2017/04/24 09:40:26
Done.
|
+ // AudioProcessingSimulator::ProcessStream in order not to call |
+ // GainControl::set_stream_analog_level() and |
+ // GainControl::stream_analog_level() before and after |
+ // AudioProcessing::ProcessStream respectively. |
+ *skip_analog_level_update = !msg.has_level() && !settings_.simulate_mic_gain; |
+ if (!settings_.simulate_mic_gain && msg.has_level()) { |
aleloi
2017/04/21 11:46:42
The logic gets simpler (less negations) if skip_an
AleBzk
2017/04/24 09:40:26
Done.
|
+ // The analog gain simulation is off, use the level stored in the AECdump. |
+ last_specified_microphone_level_ = msg.level(); |
} |
} |
@@ -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 skip_analog_level_update = false; |
+ PrepareProcessStreamCall(msg, &skip_analog_level_update); |
+ ProcessStream(interface_used_ == InterfaceType::kFixedInterface, |
+ skip_analog_level_update); |
VerifyProcessStreamBitExactness(msg); |
} |