From fb4945101476036ee973d81f383f8bcee180691f Mon Sep 17 00:00:00 2001 From: Bjorn Volcker Date: Wed, 22 Apr 2015 06:39:58 +0200 Subject: [PATCH] Disables mic bump-up level if not built with chromium In http://chromegw.corp.google.com/viewvc/chrome-internal?view=rev&revision=61016 a feature to bump up low input audio levels to a fixed value of 33%. In https://webrtc-codereview.appspot.com/43109004/ a configuration to choose an arbitrary level was added, but still using 33% as default. The original bump-up feature was added to fix audio issues in chrome, but affected also non-chrome users. This CL disables the feature for non-chrome applications. Note that the default value is set to 0, but any value up to 12 will do. Zero was selected because it is more clear that the feature is turned off. BUG=4529 R=andrew@webrtc.org, tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/43259004 Cr-Commit-Position: refs/heads/master@{#9048} --- webrtc/modules/audio_processing/include/audio_processing.h | 4 ++++ webrtc/tools/agc/agc_manager_unittest.cc | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index f91d53aff2..63c70f7e2a 100644 --- a/webrtc/modules/audio_processing/include/audio_processing.h +++ b/webrtc/modules/audio_processing/include/audio_processing.h @@ -78,7 +78,11 @@ struct ReportedDelay { // [12, 255]. Here, 255 maps to 100%. // // Must be provided through AudioProcessing::Create(Confg&). +#if defined(WEBRTC_CHROMIUM_BUILD) static const int kAgcStartupMinVolume = 85; +#else +static const int kAgcStartupMinVolume = 0; +#endif // defined(WEBRTC_CHROMIUM_BUILD) struct ExperimentalAgc { ExperimentalAgc() : enabled(true), startup_min_volume(kAgcStartupMinVolume) {} ExperimentalAgc(bool enabled) diff --git a/webrtc/tools/agc/agc_manager_unittest.cc b/webrtc/tools/agc/agc_manager_unittest.cc index e126c017f2..c379d2d5b0 100644 --- a/webrtc/tools/agc/agc_manager_unittest.cc +++ b/webrtc/tools/agc/agc_manager_unittest.cc @@ -388,8 +388,13 @@ TEST_F(AgcManagerUnitTest, ChangingDevicesChecksVolume) { TEST_F(AgcManagerUnitTest, LowInitialVolumeIsRaised) { ExpectCheckVolumeAndReset(11u); - // Should set MicVolume to kMinInitMicLevel = 85. +#if defined(WEBRTC_CHROMIUM_BUILD) + // Should set MicVolume to kMinInitMicLevel = 85 if built with Chromium. EXPECT_CALL(volume_, SetMicVolume(Eq(85u))).WillOnce(Return(0)); +#else + // Otherwise it will raise to the kMinMicLevel = 12. + EXPECT_CALL(volume_, SetMicVolume(Eq(12u))).WillOnce(Return(0)); +#endif PostProcCallback(1); EXPECT_CALL(*agc_, GetRmsErrorDb(_)) .WillOnce(Return(false));