| Index: chromeos/audio/cras_audio_handler.cc
|
| diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
|
| index cb3e47ea1cf9a12fa3339c05a54435af26ed1ee3..d08d237578e51c6ef962e401775e63f28bec09fc 100644
|
| --- a/chromeos/audio/cras_audio_handler.cc
|
| +++ b/chromeos/audio/cras_audio_handler.cc
|
| @@ -831,15 +831,28 @@ void CrasAudioHandler::UpdateDevicesAndSwitchActive(
|
| if (input_devices_changed &&
|
| !NonActiveDeviceUnplugged(old_audio_devices_size,
|
| audio_devices_.size(),
|
| - active_input_node_id_) &&
|
| - !input_devices_pq_.empty())
|
| - SwitchToDevice(input_devices_pq_.top(), true);
|
| + active_input_node_id_)) {
|
| + // Some devices like chromeboxes don't have the internal audio input. In
|
| + // that case the active input node id should be reset.
|
| + if (input_devices_pq_.empty()) {
|
| + active_input_node_id_ = 0;
|
| + NotifyActiveNodeChanged(true);
|
| + } else {
|
| + SwitchToDevice(input_devices_pq_.top(), true);
|
| + }
|
| + }
|
| if (output_devices_changed &&
|
| !NonActiveDeviceUnplugged(old_audio_devices_size,
|
| audio_devices_.size(),
|
| - active_output_node_id_) &&
|
| - !output_devices_pq_.empty()) {
|
| - SwitchToDevice(output_devices_pq_.top(), true);
|
| + active_output_node_id_)) {
|
| + // This is really unlikely to happen because all ChromeOS devices have the
|
| + // internal audio output.
|
| + if (output_devices_pq_.empty()) {
|
| + active_output_node_id_ = 0;
|
| + NotifyActiveNodeChanged(false);
|
| + } else {
|
| + SwitchToDevice(output_devices_pq_.top(), true);
|
| + }
|
| }
|
| }
|
|
|
|
|