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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 2270693005: 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@2785
Patch Set: Created 4 years, 4 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 456ce6cc54414a3d9f937324eb8f8dd1988c5456..1fed1566b9bb639110f572e29ca8f820e7b5eca1 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -1015,12 +1015,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