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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 1109793005: Fix the issue where the active output device is lost after the device suspend/resume without any ac… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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 52af951687b3b267ae360f4fd6dabb977c613332..3a86d8676ff483bb52be7955b979ba21ad5de1bf 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -852,10 +852,13 @@ void CrasAudioHandler::UpdateDevicesAndSwitchActive(
}
// If the previous active device is removed from the new node list,
- // reset active_output_node_id_.
- if (!GetDeviceFromId(active_output_node_id_))
+ // or changed to inactive by cras, reset active_output_node_id_.
+ // See crbug.com/478968.
+ const AudioDevice* active_output = GetDeviceFromId(active_output_node_id_);
+ if (!active_output || !active_output->active)
active_output_node_id_ = 0;
- if (!GetDeviceFromId(active_input_node_id_))
+ const AudioDevice* active_input = GetDeviceFromId(active_input_node_id_);
+ if (!active_input || !active_input->active)
active_input_node_id_ = 0;
// If audio nodes change is caused by unplugging some non-active audio
« 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