From f005a000943f4f708662080c122c9c421793224d Mon Sep 17 00:00:00 2001 From: peah Date: Fri, 28 Oct 2016 05:02:34 -0700 Subject: [PATCH] Added calling of the stream_analog_level api in audioproc_f The test program audioproc_f does not call the stream_analog_level method. This should be done do 1) Ensure that proper log output is produced when reproducing a call. 2) Ensure that this method is properly tested. 3) Ensure that the correct side-effects are triggered (this method is not const). BUG=webrtc:6564 Review-Url: https://codereview.webrtc.org/2449043008 Cr-Commit-Position: refs/heads/master@{#14817} --- .../test/aec_dump_based_simulator.cc | 14 ++++++++++++-- .../test/aec_dump_based_simulator.h | 3 ++- .../audio_processing/test/wav_based_simulator.cc | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) 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 c2983fc625..266e649181 100644 --- a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc +++ b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc @@ -63,7 +63,8 @@ bool VerifyFloatBitExactness(const webrtc::audioproc::Stream& msg, } // namespace void AecDumpBasedSimulator::PrepareProcessStreamCall( - const webrtc::audioproc::Stream& msg) { + const webrtc::audioproc::Stream& msg, + bool* set_stream_analog_level_called) { if (msg.has_input_data()) { // Fixed interface processing. // Verify interface invariance. @@ -127,6 +128,9 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall( 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; } } @@ -507,8 +511,14 @@ void AecDumpBasedSimulator::HandleMessage(const webrtc::audioproc::Init& msg) { void AecDumpBasedSimulator::HandleMessage( const webrtc::audioproc::Stream& msg) { - PrepareProcessStreamCall(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(); + } + VerifyProcessStreamBitExactness(msg); } diff --git a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.h b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.h index c3d273cf4a..7f98f43b66 100644 --- a/webrtc/modules/audio_processing/test/aec_dump_based_simulator.h +++ b/webrtc/modules/audio_processing/test/aec_dump_based_simulator.h @@ -42,7 +42,8 @@ class AecDumpBasedSimulator final : public AudioProcessingSimulator { void HandleMessage(const webrtc::audioproc::Stream& msg); void HandleMessage(const webrtc::audioproc::ReverseStream& msg); void HandleMessage(const webrtc::audioproc::Config& msg); - void PrepareProcessStreamCall(const webrtc::audioproc::Stream& msg); + void PrepareProcessStreamCall(const webrtc::audioproc::Stream& msg, + bool* set_stream_analog_level_called); void PrepareReverseProcessStreamCall( const webrtc::audioproc::ReverseStream& msg); void VerifyProcessStreamBitExactness(const webrtc::audioproc::Stream& msg); diff --git a/webrtc/modules/audio_processing/test/wav_based_simulator.cc b/webrtc/modules/audio_processing/test/wav_based_simulator.cc index 673b274f72..dd680dfdfb 100644 --- a/webrtc/modules/audio_processing/test/wav_based_simulator.cc +++ b/webrtc/modules/audio_processing/test/wav_based_simulator.cc @@ -100,6 +100,8 @@ bool WavBasedSimulator::HandleProcessStreamCall() { if (samples_left_to_process) { PrepareProcessStreamCall(); ProcessStream(settings_.fixed_interface); + // Call stream analog level to ensure that any side-effects are triggered. + (void)ap_->gain_control()->stream_analog_level(); last_specified_microphone_level_ = ap_->gain_control()->stream_analog_level(); }