AEC dump Stream::level renamed

Making it clear that the field is used to store the applied input
volume and not the recommended input volume.

Bug: webrtc:7494, b/241923537
Change-Id: Ib91bc1a12348f63e3a4ba6e068ed02e40786a87b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271342
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38051}
This commit is contained in:
Alessio Bazzica 2022-09-05 16:05:24 +02:00 committed by WebRTC LUCI CQ
parent 767f504875
commit 3153b363cd
8 changed files with 16 additions and 13 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -67,7 +67,7 @@ class AecDump {
struct AudioProcessingState {
int delay;
int drift;
int level;
int applied_input_volume;
bool keypress;
};

View file

@ -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(

View file

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

View file

@ -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 {