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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 2189463004: Fix the corner case for new audio device is not selected as active if it is plugged in for the firs… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: chromeos/audio/cras_audio_handler.cc
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index a8f8036134ead71310d5a6748f4230045971f1f3..6a12d344cf4e662c2368882f380ed6b82867c889 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -1016,12 +1016,18 @@ bool CrasAudioHandler::GetActiveDeviceFromUserPref(bool is_input,
bool active = false;
bool activate_by_user = false;
+ // If the device entry is not found in prefs, it is likley a new audio
+ // device plugged in after the cros is powered down. We should ignore the
+ // previously saved active device, and select the active device by priority.
+ // crbug.com/622045.
if (!audio_pref_handler_->GetDeviceActive(device, &active,
- &activate_by_user) ||
- !active) {
- continue;
+ &activate_by_user)) {
+ return false;
}
+ if (!active)
+ continue;
+
if (!found_active_device) {
found_active_device = true;
*active_device = device;
« no previous file with comments | « chromeos/audio/audio_devices_pref_handler_impl_unittest.cc ('k') | chromeos/audio/cras_audio_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698