AdaptiveDigitalGainController: Add method GetSpeechLevelDbfsIfConfident
Bug: webrtc:7494 Change-Id: I18d8ee4e50f6fd901f29e4591ff12759018d070d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/277381 Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Commit-Queue: Hanna Silen <silen@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38303}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
ab9849adbc
commit
09c292f84d
@ -105,4 +105,11 @@ void AdaptiveDigitalGainController::HandleInputGainChange() {
|
||||
saturation_protector_->Reset();
|
||||
}
|
||||
|
||||
absl::optional<float>
|
||||
AdaptiveDigitalGainController::GetSpeechLevelDbfsIfConfident() const {
|
||||
return speech_level_estimator_.IsConfident()
|
||||
? absl::optional<float>(speech_level_estimator_.level_dbfs())
|
||||
: absl::nullopt;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/audio_processing/agc2/adaptive_digital_gain_applier.h"
|
||||
#include "modules/audio_processing/agc2/adaptive_mode_level_estimator.h"
|
||||
#include "modules/audio_processing/agc2/noise_level_estimator.h"
|
||||
@ -50,6 +51,10 @@ class AdaptiveDigitalGainController {
|
||||
// Handles a gain change applied to the input signal (e.g., analog gain).
|
||||
void HandleInputGainChange();
|
||||
|
||||
// Returns the most recent speech level (dBFs) if the estimator is confident.
|
||||
// Otherwise returns absl::nullopt.
|
||||
absl::optional<float> GetSpeechLevelDbfsIfConfident() const;
|
||||
|
||||
private:
|
||||
AdaptiveModeLevelEstimator speech_level_estimator_;
|
||||
AdaptiveDigitalGainApplier gain_controller_;
|
||||
|
||||
Reference in New Issue
Block a user