diff options
author | Tommi <tommi@chromium.org> | 2015-11-13 21:23:10 +0100 |
---|---|---|
committer | Tommi <tommi@chromium.org> | 2015-11-13 20:27:01 +0000 |
commit | 73f43fc68259260a20448a5a89c0a49462f37e3f (patch) | |
tree | 2e2e69f4dad8b8aca2281416a2b7b1cb8a5539b9 /content/renderer | |
parent | 52fad32d534a9b31515ddaa53024e469ef32ea07 (diff) | |
download | chromium_src-73f43fc68259260a20448a5a89c0a49462f37e3f.zip chromium_src-73f43fc68259260a20448a5a89c0a49462f37e3f.tar.gz chromium_src-73f43fc68259260a20448a5a89c0a49462f37e3f.tar.bz2 |
Add support for a command line switch: agc-startup-min-volume
This allows Chrome to be started with a value that overrides the default
starting volume value of WebRTCs Automatic Gain Control algorithm.
Some input devices have a gain input curve that doesn't agree with
the default starting value, so this switch is a useful tool to
test valid values as well as a way to work around configuration
(possibly hardware or driver related) issues in fixed setups.
BUG=555104,555577
R=avi@chromium.org, henrika@chromium.org
Review URL: https://codereview.chromium.org/1440083002 .
Cr-Commit-Position: refs/heads/master@{#359619}
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/media/media_stream_audio_processor.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc index c736696..5e4c1c0 100644 --- a/content/renderer/media/media_stream_audio_processor.cc +++ b/content/renderer/media/media_stream_audio_processor.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" +#include "base/strings/string_number_conversions.h" #include "base/trace_event/trace_event.h" #include "content/public/common/content_switches.h" #include "content/renderer/media/media_stream_audio_processor_options.h" @@ -107,6 +108,17 @@ bool IsDelayAgnosticAecEnabled() { return (group_name == "Enabled" || group_name == "DefaultEnabled"); } +// Checks if the default minimum starting volume value for the AGC is overridden +// on the command line. +bool GetStartupMinVolumeForAgc(int* startup_min_volume) { + DCHECK(startup_min_volume); + std::string min_volume_str( + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kAgcStartupMinVolume)); + return !min_volume_str.empty() && + base::StringToInt(min_volume_str, startup_min_volume); +} + } // namespace // Wraps AudioBus to provide access to the array of channel pointers, since this @@ -528,6 +540,16 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( new webrtc::Beamforming(geometry.size() > 1, geometry)); } + // If the experimental AGC is enabled, check for overridden config params. + if (audio_constraints.GetProperty( + MediaAudioConstraints::kGoogExperimentalAutoGainControl)) { + int startup_min_volume = 0; + if (GetStartupMinVolumeForAgc(&startup_min_volume)) { + config.Set<webrtc::ExperimentalAgc>( + new webrtc::ExperimentalAgc(true, startup_min_volume)); + } + } + // Create and configure the webrtc::AudioProcessing. audio_processing_.reset(webrtc::AudioProcessing::Create(config)); |