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

Unified Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 2801853005: Create a private API for controlling WebRTC's AEC3 (Closed)
Patch Set: After grunell's second round of comments Created 3 years, 8 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
Index: content/renderer/media/media_stream_audio_processor.cc
diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc
index 46d742807bd5c20e4b6fba0bb13223cea158244d..2a518cb24ef2bef237bb990202f845b4ee626228 100644
--- a/content/renderer/media/media_stream_audio_processor.cc
+++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -486,6 +486,25 @@ void MediaStreamAudioProcessor::OnDisableAecDump() {
StopEchoCancellationDump(audio_processing_.get());
}
+void MediaStreamAudioProcessor::OnAec3Enable(bool enable) {
+ DCHECK(main_thread_runner_->BelongsToCurrentThread());
+ if (override_aec3_ == base::Optional<bool>(enable))
Henrik Grunell 2017/04/10 17:08:40 Nit: can be written if (override_aec3_ == enable)
hlundin-chromium 2017/04/11 09:19:37 Done.
+ return;
+
+ override_aec3_ = base::Optional<bool>(enable);
Henrik Grunell 2017/04/10 17:08:40 Nit: override_aec3_ = enable;
hlundin-chromium 2017/04/11 09:19:37 Done.
+ if (!has_echo_cancellation_)
+ return;
+
+ auto apm_config = audio_processing_->GetConfig();
+ if (apm_config.echo_canceller3.enabled == enable)
+ return;
+
+ apm_config.echo_canceller3.enabled = enable;
+ audio_processing_->ApplyConfig(apm_config);
+ DCHECK(echo_information_);
+ echo_information_.reset(new EchoInformation());
+}
+
void MediaStreamAudioProcessor::OnIpcClosing() {
DCHECK(main_thread_runner_->BelongsToCurrentThread());
aec_dump_message_filter_ = NULL;
@@ -596,6 +615,7 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
const bool echo_cancellation =
audio_constraints.GetEchoCancellationProperty();
+ has_echo_cancellation_ = echo_cancellation;
const bool goog_agc = audio_constraints.GetGoogAutoGainControl();
#if defined(OS_ANDROID)
@@ -680,7 +700,9 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
echo_information_.reset(new EchoInformation());
apm_config.echo_canceller3.enabled =
- base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3);
+ override_aec3_
+ ? *override_aec3_
+ : base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3);
} else {
apm_config.echo_canceller3.enabled = false;
}

Powered by Google App Engine
This is Rietveld 408576698