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

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

Issue 2834643002: audioproc_f with simulated mic analog gain (Closed)
Patch Set: set_stream_analog_level and stream_analog_level moved into parent class AudioProcessingSimulator 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 d2c274f460010af7976fc2a2f1032c8bb72ecc8a..b8287582a03de31393b5438c7a336fbab79bc1ac 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,34 @@ 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 skip_analog_level_update) {
+ if (!skip_analog_level_update)
aleloi 2017/04/21 11:46:42 Add brackets. Also, suggest changing |if not skip_
AleBzk 2017/04/24 09:40:26 Done.
+ 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_
+ // 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
+ // or the default if settings_.simulate_mic_gain is false.
+ // TODO(alessiob): Check what the default value should be, probably 100 is ok.
+ if (!skip_analog_level_update)
aleloi 2017/04/21 11:46:42 Add brackets
AleBzk 2017/04/24 09:40:26 Done.
+ last_specified_microphone_level_ = (settings_.simulate_mic_gain) ?
aleloi 2017/04/21 11:46:42 Suggest drop parentheses.
AleBzk 2017/04/24 09:40:26 Done.
+ ap_->gain_control()->stream_analog_level() : 100;
if (buffer_writer_) {
buffer_writer_->Write(*out_buf_);

Powered by Google App Engine
This is Rietveld 408576698