Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 751773002: Reset the active audio node id once all of the devices are gone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/audio/cras_audio_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
« no previous file with comments | « no previous file | chromeos/audio/cras_audio_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698