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

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

Issue 2834643002: audioproc_f with simulated mic analog gain (Closed)
Patch Set: Merge + comments addressed Created 3 years, 6 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 4a5ada53c0febf7d3fbc70b8fea53ff3e81aab03..74f7c4fdd2cf7934010838d95fdfe33b0eb0ecfd 100644
--- a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc
+++ b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc
@@ -13,6 +13,7 @@
#include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h"
#include "webrtc/base/checks.h"
+#include "webrtc/base/logging.h"
#include "webrtc/modules/audio_processing/test/protobuf_utils.h"
#include "webrtc/test/testsupport/trace_to_stderr.h"
@@ -64,13 +65,18 @@ bool VerifyFloatBitExactness(const webrtc::audioproc::Stream& msg,
} // namespace
AecDumpBasedSimulator::AecDumpBasedSimulator(const SimulationSettings& settings)
- : AudioProcessingSimulator(settings) {}
+ : AudioProcessingSimulator(settings) {
+ if (settings_.simulate_mic_gain) {
+ LOG(LS_VERBOSE)
+ << "Simulating analog mic gain using AEC dump as input "
AleBzk 2017/06/29 11:43:36 Just git cl format
+ << "(the unmodified mic gain level will be virtually restored)";
peah-webrtc 2017/06/29 22:03:59 This comment is not really fully correct, right?
AleBzk 2017/07/26 13:42:30 Done.
+ }
+}
AecDumpBasedSimulator::~AecDumpBasedSimulator() = default;
void AecDumpBasedSimulator::PrepareProcessStreamCall(
- const webrtc::audioproc::Stream& msg,
- bool* set_stream_analog_level_called) {
+ const webrtc::audioproc::Stream& msg) {
if (msg.has_input_data()) {
// Fixed interface processing.
// Verify interface invariance.
@@ -159,15 +165,9 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall(
ap_->set_stream_key_pressed(*settings_.use_ts);
}
- // 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;
- }
+ // Level is always logged in AEC dumps.
+ RTC_CHECK(msg.has_level());
+ aec_dump_mic_level_ = rtc::Optional<int>(msg.level());
}
void AecDumpBasedSimulator::VerifyProcessStreamBitExactness(
@@ -565,14 +565,8 @@ 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);
+ PrepareProcessStreamCall(msg);
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();
- }
-
VerifyProcessStreamBitExactness(msg);
}

Powered by Google App Engine
This is Rietveld 408576698