Reland "Reland "Remove unused APM voice activity detection sub-module""

This reverts commit 09aaf6f7bcfb4da644bd86c76896a04a41f776e1.

Reason for revert: downstream fixed (see https://chromium-review.googlesource.com/c/chromium/src/+/3461371)

Original change's description:
> Revert "Reland "Remove unused APM voice activity detection sub-module""
>
> This reverts commit 54d1344d985b00d4d1580dd18057d4618c11ad1f.
>
> Reason for revert: Breaks chromium roll, see 
> https://ci.chromium.org/ui/p/chromium/builders/try/linux_chromium_tsan_rel_ng/1080583/overview
>
> https://chromium-review.googlesource.com/c/chromium/src/+/3461512
>
> Original change's description:
> > Reland "Remove unused APM voice activity detection sub-module"
> >
> > This reverts commit a751f167c68343f76528436defdbc61600a8d7b3.
> >
> > Reason for revert: dependency in a downstream project removed
> >
> > Original change's description:
> > > Revert "Remove unused APM voice activity detection sub-module"
> > >
> > > This reverts commit b4e06d032e6f82a65c52ed0c5364ae9e7c0a0215.
> > >
> > > Reason for revert: breaking downstream projects
> > >
> > > Original change's description:
> > > > Remove unused APM voice activity detection sub-module
> > > >
> > > > API changes:
> > > > - webrtc::AudioProcessing::Config::VoiceDetection removed
> > > > - webrtc::AudioProcessingStats::voice_detected deprecated
> > > > - cricket::AudioOptions::typing_detection deprecated
> > > > - webrtc::StatsReport::StatsValueName::
> > > >   kStatsValueNameTypingNoiseState deprecated
> > > >
> > > > PSA: https://groups.google.com/g/discuss-webrtc/c/7X6uwmJarE0
> > > >
> > > > Bug: webrtc:11226,webrtc:11292
> > > > Change-Id: I8d008b56708cf62961b9857ec052b59fda3b41bf
> > > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250666
> > > > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > > > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > > > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/main@{#35975}
> > >
> > > TBR=gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
> > >
> > > Change-Id: Iee01fdb874b4e0331277f3ffe60dacaabc3859a2
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: webrtc:11226,webrtc:11292
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251600
> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> > > Cr-Commit-Position: refs/heads/main@{#35977}
> >
> > # Not skipping CQ checks because this is a reland.
> >
> > Bug: webrtc:11226,webrtc:11292
> > Change-Id: I2fcbc5fdade16bfe6a0f0a02841a33a598d4f2ad
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251660
> > Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35984}
>
> TBR=mbonadei@webrtc.org,gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: Ib308a3af2dcce85a0074ef5a4680ccec3f82712f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:11226,webrtc:11292
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251688
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35990}

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:11226,webrtc:11292
Change-Id: Idfda6a517027ad323caf44c526a88468e5b52b65
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251762
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36012}
This commit is contained in:
Alessio Bazzica
2022-02-15 14:18:09 +00:00
committed by WebRTC LUCI CQ
parent 5ae9b260ff
commit 1db0a261ca
23 changed files with 18 additions and 483 deletions

View File

@ -141,7 +141,6 @@ bool AudioProcessingImpl::SubmoduleStates::Update(
bool gain_controller2_enabled,
bool gain_adjustment_enabled,
bool echo_controller_enabled,
bool voice_detector_enabled,
bool transient_suppressor_enabled) {
bool changed = false;
changed |= (high_pass_filter_enabled != high_pass_filter_enabled_);
@ -153,7 +152,6 @@ bool AudioProcessingImpl::SubmoduleStates::Update(
changed |= (gain_controller2_enabled != gain_controller2_enabled_);
changed |= (gain_adjustment_enabled != gain_adjustment_enabled_);
changed |= (echo_controller_enabled != echo_controller_enabled_);
changed |= (voice_detector_enabled != voice_detector_enabled_);
changed |= (transient_suppressor_enabled != transient_suppressor_enabled_);
if (changed) {
high_pass_filter_enabled_ = high_pass_filter_enabled;
@ -163,7 +161,6 @@ bool AudioProcessingImpl::SubmoduleStates::Update(
gain_controller2_enabled_ = gain_controller2_enabled;
gain_adjustment_enabled_ = gain_adjustment_enabled;
echo_controller_enabled_ = echo_controller_enabled;
voice_detector_enabled_ = voice_detector_enabled;
transient_suppressor_enabled_ = transient_suppressor_enabled;
}
@ -174,7 +171,7 @@ bool AudioProcessingImpl::SubmoduleStates::Update(
bool AudioProcessingImpl::SubmoduleStates::CaptureMultiBandSubModulesActive()
const {
return CaptureMultiBandProcessingPresent() || voice_detector_enabled_;
return CaptureMultiBandProcessingPresent();
}
bool AudioProcessingImpl::SubmoduleStates::CaptureMultiBandProcessingPresent()
@ -371,7 +368,6 @@ void AudioProcessingImpl::InitializeLocked() {
InitializeGainController1();
InitializeTransientSuppressor();
InitializeHighPassFilter(true);
InitializeVoiceDetector();
InitializeResidualEchoDetector();
InitializeEchoController();
InitializeGainController2(/*config_has_changed=*/true);
@ -506,9 +502,6 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
const bool agc2_config_changed =
config_.gain_controller2 != config.gain_controller2;
const bool voice_detection_config_changed =
config_.voice_detection.enabled != config.voice_detection.enabled;
const bool ns_config_changed =
config_.noise_suppression.enabled != config.noise_suppression.enabled ||
config_.noise_suppression.level != config.noise_suppression.level;
@ -557,10 +550,6 @@ void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
InitializeCaptureLevelsAdjuster();
}
if (voice_detection_config_changed) {
InitializeVoiceDetector();
}
// Reinitialization must happen after all submodule configuration to avoid
// additional reinitializations on the next capture / render processing call.
if (pipeline_config_changed) {
@ -1215,13 +1204,6 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
}
}
if (config_.voice_detection.enabled) {
capture_.stats.voice_detected =
submodules_.voice_detector->ProcessCaptureAudio(capture_buffer);
} else {
capture_.stats.voice_detected = absl::nullopt;
}
if (submodules_.agc_manager) {
submodules_.agc_manager->Process(capture_buffer);
@ -1682,7 +1664,7 @@ bool AudioProcessingImpl::UpdateActiveSubmoduleStates() {
!!submodules_.gain_controller2,
config_.pre_amplifier.enabled || config_.capture_level_adjustment.enabled,
capture_nonlocked_.echo_controller_enabled,
config_.voice_detection.enabled, !!submodules_.transient_suppressor);
!!submodules_.transient_suppressor);
}
void AudioProcessingImpl::InitializeTransientSuppressor() {
@ -1732,14 +1714,6 @@ void AudioProcessingImpl::InitializeHighPassFilter(bool forced_reset) {
}
}
void AudioProcessingImpl::InitializeVoiceDetector() {
if (config_.voice_detection.enabled) {
submodules_.voice_detector = std::make_unique<VoiceDetection>(
proc_split_sample_rate_hz(), VoiceDetection::kVeryLowLikelihood);
} else {
submodules_.voice_detector.reset();
}
}
void AudioProcessingImpl::InitializeEchoController() {
bool use_echo_controller =
echo_control_factory_ ||