Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc

Issue 2846853002: audioproc_f with fake microphone. (Closed)
Patch Set: Initialized FakeRecordingDevice, added 'kind' command line flag, fixed bugs. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9e7aad0420b79347f25d96f95747ab990206a8c7..b579f3a8a588ff91d894cbbbc780ce054f6f8743 100644
--- a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc
+++ b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc
@@ -159,15 +159,19 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall(
// TODO(peah): Add support for controlling the analog level via the
// command-line.
- RTC_CHECK(msg.has_level()); // Level is always logged in AEC dumps.
- // When the analog gain is simulated, use the gain suggested by AGC instead of
- // that stored in the AEC dump.
- RTC_CHECK_EQ(AudioProcessing::kNoError,
- ap_->gain_control()->set_stream_analog_level(
- settings_.simulate_mic_gain ?
- last_specified_microphone_level_ : msg.level()));
- // TODO(aleloi): If settings_.simulate_mic_gain, set undo level to
- // |msg.level()| via FakeRecordingDevice::NotifyAudioDeviceLevel().
+
+ // Level is always logged in AEC dumps.
+ RTC_CHECK(msg.has_level());
+ // When the analog gain is simulated, use the gain suggested by AGC
+ // instead of that stored in the AEC dump.
+ RTC_CHECK_EQ(
+ AudioProcessing::kNoError,
+ ap_->gain_control()->set_stream_analog_level(
+ settings_.simulate_mic_gain ? fake_recording_device_->analog_level()
+ : msg.level()));
+ if (settings_.simulate_mic_gain) {
+ fake_recording_device_->NotifyAudioDeviceLevel(msg.level());
+ }
}
void AecDumpBasedSimulator::VerifyProcessStreamBitExactness(
@@ -567,16 +571,12 @@ void AecDumpBasedSimulator::HandleMessage(
const webrtc::audioproc::Stream& msg) {
PrepareProcessStreamCall(msg);
ProcessStream(interface_used_ == InterfaceType::kFixedInterface);
+
+ // Call stream analog level even if !simulate_mic_gain to ensure
+ // that any side-effects are triggered.
+ const int level = ap_->gain_control()->stream_analog_level();
if (settings_.simulate_mic_gain) {
- // Store analog level for the next analyzed frame.
- last_specified_microphone_level_ =
- ap_->gain_control()->stream_analog_level();
- // TODO(aleloi): Set the returned value into a FakeRecordingDevice instance
- // via FakeRecordingDevice::set_analog_level() instead of using
- // last_specified_microphone_level_.
- } else {
- // Call stream analog level to ensure that any side-effects are triggered.
- (void)ap_->gain_control()->stream_analog_level();
+ fake_recording_device_->set_analog_level(level);
}
VerifyProcessStreamBitExactness(msg);
}

Powered by Google App Engine
This is Rietveld 408576698