diff --git a/modules/audio_processing/aec_dump/capture_stream_info.cc b/modules/audio_processing/aec_dump/capture_stream_info.cc index 7a1ee8bc4a..207fad999f 100644 --- a/modules/audio_processing/aec_dump/capture_stream_info.cc +++ b/modules/audio_processing/aec_dump/capture_stream_info.cc @@ -53,7 +53,7 @@ void CaptureStreamInfo::AddAudioProcessingState( auto* stream = event_->mutable_stream(); stream->set_delay(state.delay); stream->set_drift(state.drift); - stream->set_level(state.level); + stream->set_applied_input_volume(state.applied_input_volume); stream->set_keypress(state.keypress); } } // namespace webrtc diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 5256f9fecc..453b8d9569 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -2148,7 +2148,10 @@ void AudioProcessingImpl::RecordAudioProcessingState() { AecDump::AudioProcessingState audio_proc_state; audio_proc_state.delay = capture_nonlocked_.stream_delay_ms; audio_proc_state.drift = 0; - audio_proc_state.level = recommended_stream_analog_level_locked(); + // TODO(bugs.webrtc.org/7494): Refactor to clarify that `stream_analog_level` + // is in fact assigned to the applied volume and not to the recommended one. + audio_proc_state.applied_input_volume = + recommended_stream_analog_level_locked(); audio_proc_state.keypress = capture_.key_pressed; aec_dump_->AddAudioProcessingState(audio_proc_state); } diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc index a0514744c4..523afe9f39 100644 --- a/modules/audio_processing/audio_processing_unittest.cc +++ b/modules/audio_processing/audio_processing_unittest.cc @@ -357,7 +357,7 @@ void ExpectStreamFieldsEq(const audioproc::Stream& actual, EXPECT_EQ(actual.output_data(), expected.output_data()); EXPECT_EQ(actual.delay(), expected.delay()); EXPECT_EQ(actual.drift(), expected.drift()); - EXPECT_EQ(actual.level(), expected.level()); + EXPECT_EQ(actual.applied_input_volume(), expected.applied_input_volume()); EXPECT_EQ(actual.keypress(), expected.keypress()); } @@ -1518,7 +1518,7 @@ void ApmTest::ProcessDebugDump(absl::string_view in_filename, // ProcessStream could have changed this for the output frame. frame_.num_channels = apm_->num_input_channels(); - apm_->set_stream_analog_level(msg.level()); + apm_->set_stream_analog_level(msg.applied_input_volume()); EXPECT_NOERR(apm_->set_stream_delay_ms(msg.delay())); if (msg.has_keypress()) { apm_->set_stream_key_pressed(msg.keypress()); diff --git a/modules/audio_processing/debug.proto b/modules/audio_processing/debug.proto index 4bc1a52160..cc5efbc73c 100644 --- a/modules/audio_processing/debug.proto +++ b/modules/audio_processing/debug.proto @@ -35,7 +35,7 @@ message Stream { optional int32 delay = 3; optional sint32 drift = 4; - optional int32 level = 5; + optional int32 applied_input_volume = 5; optional bool keypress = 6; // float deinterleaved data, where each repeated element points to a single diff --git a/modules/audio_processing/include/aec_dump.h b/modules/audio_processing/include/aec_dump.h index 07477d2f82..cc31071d89 100644 --- a/modules/audio_processing/include/aec_dump.h +++ b/modules/audio_processing/include/aec_dump.h @@ -67,7 +67,7 @@ class AecDump { struct AudioProcessingState { int delay; int drift; - int level; + int applied_input_volume; bool keypress; }; diff --git a/modules/audio_processing/test/aec_dump_based_simulator.cc b/modules/audio_processing/test/aec_dump_based_simulator.cc index ec35dd345c..261734d54e 100644 --- a/modules/audio_processing/test/aec_dump_based_simulator.cc +++ b/modules/audio_processing/test/aec_dump_based_simulator.cc @@ -174,9 +174,9 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall( } } - // Level is always logged in AEC dumps. - RTC_CHECK(msg.has_level()); - aec_dump_mic_level_ = msg.level(); + // The stream analog level is always logged in the AEC dumps. + RTC_CHECK(msg.has_applied_input_volume()); + aec_dump_mic_level_ = msg.applied_input_volume(); } void AecDumpBasedSimulator::VerifyProcessStreamBitExactness( diff --git a/modules/audio_processing/test/debug_dump_replayer.cc b/modules/audio_processing/test/debug_dump_replayer.cc index 2419313e9d..4155173db4 100644 --- a/modules/audio_processing/test/debug_dump_replayer.cc +++ b/modules/audio_processing/test/debug_dump_replayer.cc @@ -121,7 +121,7 @@ void DebugDumpReplayer::OnStreamEvent(const audioproc::Stream& msg) { // APM should have been created. RTC_CHECK(apm_.get()); - apm_->set_stream_analog_level(msg.level()); + apm_->set_stream_analog_level(msg.applied_input_volume()); RTC_CHECK_EQ(AudioProcessing::kNoError, apm_->set_stream_delay_ms(msg.delay())); diff --git a/rtc_tools/unpack_aecdump/unpack.cc b/rtc_tools/unpack_aecdump/unpack.cc index 642aa5d9f6..a43fe75b36 100644 --- a/rtc_tools/unpack_aecdump/unpack.cc +++ b/rtc_tools/unpack_aecdump/unpack.cc @@ -60,7 +60,7 @@ ABSL_FLAG(std::string, ABSL_FLAG(std::string, level_file, "level.int32", - "The name of the level file."); + "The name of the applied input volume file."); ABSL_FLAG(std::string, keypress_file, "keypress.bool", @@ -468,10 +468,10 @@ int do_main(int argc, char* argv[]) { } } - if (msg.has_level()) { + if (msg.has_applied_input_volume()) { static FILE* level_file = OpenFile(absl::GetFlag(FLAGS_level_file), "wb"); - int32_t level = msg.level(); + int32_t level = msg.applied_input_volume(); if (absl::GetFlag(FLAGS_text)) { fprintf(level_file, "%d\n", level); } else {