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}
This commit is contained in:
peah 2016-10-28 05:02:34 -07:00 committed by Commit bot
parent 6d6762cb0e
commit f005a00094
3 changed files with 16 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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();
}