Chromium Code Reviews| Index: chromeos/audio/cras_audio_handler.cc |
| diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc |
| index d008d8657792756c4f5995417fb8770780c47cf5..1be1bd2b30062f99a7b5f79db15061a6ab3d43ad 100644 |
| --- a/chromeos/audio/cras_audio_handler.cc |
| +++ b/chromeos/audio/cras_audio_handler.cc |
| @@ -562,6 +562,25 @@ void CrasAudioHandler::NodesChanged() { |
| GetNodes(); |
| } |
| +void CrasAudioHandler::OutputNodeVolumeChanged(uint64_t node_id, int volume) { |
| + const AudioDevice* device = this->GetDeviceFromId(node_id); |
| + int old_volume; |
| + |
| + if (!device || device->is_input) |
| + return; |
| + |
| + // If this callback is triggered by a response to previous set volume command, |
| + // do nothing. |
| + old_volume = |
| + static_cast<int>(audio_pref_handler_->GetOutputVolumeValue(device)); |
| + if (old_volume == volume) |
| + return; |
| + |
| + // Otherwise another app or the hardware itself just changed volume, update |
| + // the new volume value. |
| + SetOutputNodeVolumePercent(node_id, volume); |
|
jennyz
2016/05/06 18:11:08
This will have a glitch for the multiple active no
hychao
2016/05/12 08:06:27
Done.
|
| +} |
| + |
| void CrasAudioHandler::ActiveOutputNodeChanged(uint64_t node_id) { |
| if (active_output_node_id_ == node_id) |
| return; |