|
16 | 16 | #include "modules/audio_processing/agc2/agc2_common.h"
|
17 | 17 | #include "modules/audio_processing/logging/apm_data_dumper.h"
|
18 | 18 | #include "rtc_base/checks.h"
|
| 19 | +#include "rtc_base/logging.h" |
19 | 20 | #include "rtc_base/numerics/safe_minmax.h"
|
20 | 21 | #include "system_wrappers/include/metrics.h"
|
21 | 22 |
|
@@ -122,16 +123,6 @@ void AdaptiveDigitalGainApplier::Process(const FrameInfo& info,
|
122 | 123 | << "`frame` does not look like a 10 ms frame for an APM supported sample "
|
123 | 124 | "rate";
|
124 | 125 |
|
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 |
| - |
135 | 126 | const float target_gain_db = LimitGainByLowConfidence(
|
136 | 127 | LimitGainByNoise(ComputeGainDb(std::min(info.input_level_dbfs, 0.f)),
|
137 | 128 | info.input_noise_level_dbfs,
|
@@ -167,5 +158,22 @@ void AdaptiveDigitalGainApplier::Process(const FrameInfo& info,
|
167 | 158 | // Remember that the gain has changed for the next iteration.
|
168 | 159 | last_gain_db_ = last_gain_db_ + gain_change_this_frame_db;
|
169 | 160 | 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 | + } |
170 | 178 | }
|
171 | 179 | } // namespace webrtc
|
0 commit comments