Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Unified Diff: webrtc/modules/audio_processing/level_controller/peak_level_estimator.cc

Issue 2283793002: Revert of Added functionality for specifying the initial signal level to use for the gain estimation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_processing/level_controller/peak_level_estimator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/level_controller/peak_level_estimator.cc
diff --git a/webrtc/modules/audio_processing/level_controller/peak_level_estimator.cc b/webrtc/modules/audio_processing/level_controller/peak_level_estimator.cc
index 9d4fe3312cfd57ae0a34b2a542862ec1049eb0d0..2ba806c8ee0d15b58c366421aaa1e2b5c20d635b 100644
--- a/webrtc/modules/audio_processing/level_controller/peak_level_estimator.cc
+++ b/webrtc/modules/audio_processing/level_controller/peak_level_estimator.cc
@@ -13,14 +13,10 @@
#include <algorithm>
#include "webrtc/modules/audio_processing/audio_buffer.h"
+#include "webrtc/modules/audio_processing/level_controller/lc_constants.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
namespace webrtc {
-namespace {
-
-const float kMinLevel = 30.f;
-
-} // namespace
PeakLevelEstimator::PeakLevelEstimator() {
Initialize();
@@ -29,26 +25,15 @@
PeakLevelEstimator::~PeakLevelEstimator() {}
void PeakLevelEstimator::Initialize() {
- peak_level_ = initial_peak_level_;
+ peak_level_ = kTargetLcPeakLevel;
hold_counter_ = 0;
initialization_phase_ = true;
-}
-
-void PeakLevelEstimator::SetInitialPeakLevel(float level) {
- RTC_DCHECK_LE(-100.f, level);
- RTC_DCHECK_GE(0.f, level);
-
- float linear_level = std::pow(10.f, level / 20.f) * 32768.f;
-
- // Limit the supplied level to the level range used internally.
- initial_peak_level_ = std::max(linear_level, kMinLevel);
- Initialize();
}
float PeakLevelEstimator::Analyze(SignalClassifier::SignalType signal_type,
float frame_peak_level) {
if (frame_peak_level == 0) {
- RTC_DCHECK_LE(kMinLevel, peak_level_);
+ RTC_DCHECK_LE(30.f, peak_level_);
return peak_level_;
}
@@ -72,7 +57,7 @@
}
}
- peak_level_ = std::max(peak_level_, kMinLevel);
+ peak_level_ = std::max(peak_level_, 30.f);
return peak_level_;
}
« no previous file with comments | « webrtc/modules/audio_processing/level_controller/peak_level_estimator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698