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

Unified Diff: webrtc/modules/audio_processing/test/audio_processing_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/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()));

Powered by Google App Engine
This is Rietveld 408576698