Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit eacbd97

Browse files
alebzkCommit Bot
authored andcommitted
AGC2 logs
- Now every 10s - Also logging estimated speech+noise level - Also logging via RTC_LOG Bug: webrtc:7494 Change-Id: Ib60a74d319d29c8f6ae4ea6dae8f2bca687c4c25 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186780 Reviewed-by: Sam Zackrisson <[email protected]> Commit-Queue: Alessio Bazzica <[email protected]> Cr-Commit-Position: refs/heads/master@{#32316}
1 parent 9f0c89b commit eacbd97

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

modules/audio_processing/agc2/adaptive_digital_gain_applier.cc

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "modules/audio_processing/agc2/agc2_common.h"
1717
#include "modules/audio_processing/logging/apm_data_dumper.h"
1818
#include "rtc_base/checks.h"
19+
#include "rtc_base/logging.h"
1920
#include "rtc_base/numerics/safe_minmax.h"
2021
#include "system_wrappers/include/metrics.h"
2122

@@ -122,16 +123,6 @@ void AdaptiveDigitalGainApplier::Process(const FrameInfo& info,
122123
<< "`frame` does not look like a 10 ms frame for an APM supported sample "
123124
"rate";
124125

125-
// Log every second.
126-
calls_since_last_gain_log_++;
127-
if (calls_since_last_gain_log_ == 100) {
128-
calls_since_last_gain_log_ = 0;
129-
RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.Agc2.DigitalGainApplied",
130-
last_gain_db_, 0, kMaxGainDb, kMaxGainDb + 1);
131-
RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.Agc2.EstimatedNoiseLevel",
132-
-info.input_noise_level_dbfs, 0, 100, 101);
133-
}
134-
135126
const float target_gain_db = LimitGainByLowConfidence(
136127
LimitGainByNoise(ComputeGainDb(std::min(info.input_level_dbfs, 0.f)),
137128
info.input_noise_level_dbfs,
@@ -167,5 +158,22 @@ void AdaptiveDigitalGainApplier::Process(const FrameInfo& info,
167158
// Remember that the gain has changed for the next iteration.
168159
last_gain_db_ = last_gain_db_ + gain_change_this_frame_db;
169160
apm_data_dumper_->DumpRaw("agc2_applied_gain_db", last_gain_db_);
161+
162+
// Log every 10 seconds.
163+
calls_since_last_gain_log_++;
164+
if (calls_since_last_gain_log_ == 1000) {
165+
calls_since_last_gain_log_ = 0;
166+
RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.Agc2.DigitalGainApplied",
167+
last_gain_db_, 0, kMaxGainDb, kMaxGainDb + 1);
168+
RTC_HISTOGRAM_COUNTS_LINEAR(
169+
"WebRTC.Audio.Agc2.EstimatedSpeechPlusNoiseLevel",
170+
-info.input_level_dbfs, 0, 100, 101);
171+
RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.Agc2.EstimatedNoiseLevel",
172+
-info.input_noise_level_dbfs, 0, 100, 101);
173+
RTC_LOG(LS_INFO) << "AGC2 adaptive digital"
174+
<< " | speech_plus_noise_dbfs: " << info.input_level_dbfs
175+
<< " | noise_dbfs: " << info.input_noise_level_dbfs
176+
<< " | gain_db: " << last_gain_db_;
177+
}
170178
}
171179
} // namespace webrtc

0 commit comments

Comments
 (0)