diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 23:16:52 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 23:16:52 +0000 |
commit | ddf63629fd036cbbbc2ee850c6395d50c1962b84 (patch) | |
tree | d39c914493ca39ae99d802d8b91c048a2b79960a | |
parent | 896862e30005f027336f8270f005a55f768dd418 (diff) | |
download | chromium_src-ddf63629fd036cbbbc2ee850c6395d50c1962b84.zip chromium_src-ddf63629fd036cbbbc2ee850c6395d50c1962b84.tar.gz chromium_src-ddf63629fd036cbbbc2ee850c6395d50c1962b84.tar.bz2 |
Merge 218957 "Remove input gain switching and sanity checks."
> Remove input gain switching and sanity checks.
> Do not set input gain when switching the active device. Also do not sanitize input gain values to be between 0-100. Since some places the handling is commong, this CL adds output volume sanitization when we set the output volume, and when we read the volume from preferences.
>
> R=jennyz@chromium.org
> BUG=273872
>
> Review URL: https://chromiumcodereview.appspot.com/23205025
TBR=rkc@chromium.org
Review URL: https://codereview.chromium.org/23494010
git-svn-id: svn://svn.chromium.org/chrome/branches/1547/src@220117 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc | 1 | ||||
-rw-r--r-- | chromeos/audio/cras_audio_handler.cc | 22 |
2 files changed, 13 insertions, 10 deletions
diff --git a/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc b/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc index b43afdb..44b1303 100644 --- a/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc +++ b/chrome/browser/chromeos/audio/audio_devices_pref_handler_impl.cc @@ -45,7 +45,6 @@ double AudioDevicesPrefHandlerImpl::GetVolumeGainValue( void AudioDevicesPrefHandlerImpl::SetVolumeGainValue( const AudioDevice& device, double value) { - value = std::min(std::max(value, 0.0), 100.0); device_volume_settings_->SetDouble(GetDeviceIdString(device), value); SaveDevicesVolumePref(); diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc index ab39a55..7fdf4c0 100644 --- a/chromeos/audio/cras_audio_handler.cc +++ b/chromeos/audio/cras_audio_handler.cc @@ -198,10 +198,10 @@ void CrasAudioHandler::SetOutputVolumePercent(int volume_percent) { FOR_EACH_OBSERVER(AudioObserver, observers_, OnOutputVolumeChanged()); } +// TODO: Rename the 'Percent' to something more meaningful. void CrasAudioHandler::SetInputGainPercent(int gain_percent) { - gain_percent = min(max(gain_percent, 0), 100); - if (gain_percent <= kMuteThresholdPercent) - gain_percent = 0; + // NOTE: We do not sanitize input gain values since the range is completely + // dependent on the device. input_gain_ = gain_percent; if (const AudioDevice* device = GetDeviceFromId(active_input_node_id_)) @@ -269,12 +269,14 @@ void CrasAudioHandler::SetVolumeGainPercentForDevice(uint64 device_id, return; } - value = min(max(value, 0), 100); - if (value <= kMuteThresholdPercent) - value = 0; - - if (const AudioDevice* device = GetDeviceFromId(device_id)) + if (const AudioDevice* device = GetDeviceFromId(device_id)) { + if (!device->is_input) { + value = min(max(value, 0), 100); + if (value <= kMuteThresholdPercent) + value = 0; + } audio_pref_handler_->SetVolumeGainValue(*device, value); + } } void CrasAudioHandler::SetMuteForDevice(uint64 device_id, bool mute_on) { @@ -410,7 +412,8 @@ void CrasAudioHandler::SetupAudioInputState() { } SetInputMuteInternal(input_mute_on_); - SetInputGainInternal(input_gain_); + // TODO(rkc,jennyz): Set input gain once we decide on how to store + // the gain values since the range and step are both device specific. } void CrasAudioHandler::SetupAudioOutputState() { @@ -423,6 +426,7 @@ void CrasAudioHandler::SetupAudioOutputState() { output_volume_ = kDefaultVolumeGainPercent; } + SetOutputMuteInternal(output_mute_on_); SetOutputVolumeInternal(output_volume_); } |