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

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

Issue 2801853005: Create a private API for controlling WebRTC's AEC3 (Closed)
Patch Set: Fixing typo 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..d5314117518c5912fa0b06fb42fd0da7ce003909 100644
--- a/content/renderer/media/media_stream_audio_processor.cc
+++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -323,6 +323,7 @@ MediaStreamAudioProcessor::MediaStreamAudioProcessor(
const MediaStreamDevice::AudioDeviceParameters& input_params,
WebRtcPlayoutDataSource* playout_data_source)
: render_delay_ms_(0),
+ has_echo_cancellation_(false),
playout_data_source_(playout_data_source),
main_thread_runner_(base::ThreadTaskRunnerHandle::Get()),
audio_mirroring_(false),
@@ -486,6 +487,25 @@ void MediaStreamAudioProcessor::OnDisableAecDump() {
StopEchoCancellationDump(audio_processing_.get());
}
+void MediaStreamAudioProcessor::OnAec3Enable(bool enable) {
+ DCHECK(main_thread_runner_->BelongsToCurrentThread());
+ if (override_aec3_ == enable)
+ return;
+
+ override_aec3_ = enable;
+ 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 +616,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)
@@ -679,8 +700,8 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
// |echo_information_| we simply discard it.
echo_information_.reset(new EchoInformation());
- apm_config.echo_canceller3.enabled =
- base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3);
+ apm_config.echo_canceller3.enabled = override_aec3_.value_or(
+ base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3));
} else {
apm_config.echo_canceller3.enabled = false;
}
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.h ('k') | content/renderer/media/media_stream_audio_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698