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

Unified Diff: chromeos/audio/audio_device.cc

Issue 2609863007: Add new mic types (Closed)
Patch Set: Add comment to explain why rear mic has lower priority Created 3 years, 11 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 | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/audio/audio_device.cc
diff --git a/chromeos/audio/audio_device.cc b/chromeos/audio/audio_device.cc
index 5039644920814f1e6afce194afe1a7b112b18bcd..b77fd4effac9060d41b6221e7c3ef36ac9c9e57a 100644
--- a/chromeos/audio/audio_device.cc
+++ b/chromeos/audio/audio_device.cc
@@ -34,7 +34,11 @@ uint8_t GetDevicePriority(AudioDeviceType type, bool is_input) {
return 2;
case AUDIO_TYPE_INTERNAL_SPEAKER:
case AUDIO_TYPE_INTERNAL_MIC:
+ case AUDIO_TYPE_FRONT_MIC:
return 1;
+ // Rear mic should have priority lower than front mic to prevent poor
+ // quality input caused by accidental selecting to rear side mic.
+ case AUDIO_TYPE_REAR_MIC:
case AUDIO_TYPE_KEYBOARD_MIC:
case AUDIO_TYPE_HOTWORD:
case AUDIO_TYPE_POST_MIX_LOOPBACK:
@@ -64,6 +68,10 @@ std::string AudioDevice::GetTypeString(AudioDeviceType type) {
return "INTERNAL_SPEAKER";
case AUDIO_TYPE_INTERNAL_MIC:
return "INTERNAL_MIC";
+ case AUDIO_TYPE_FRONT_MIC:
+ return "FRONT_MIC";
+ case AUDIO_TYPE_REAR_MIC:
+ return "REAR_MIC";
case AUDIO_TYPE_KEYBOARD_MIC:
return "KEYBOARD_MIC";
case AUDIO_TYPE_HOTWORD:
@@ -87,6 +95,10 @@ AudioDeviceType AudioDevice::GetAudioType(
return AUDIO_TYPE_HEADPHONE;
else if (node_type.find("INTERNAL_MIC") != std::string::npos)
return AUDIO_TYPE_INTERNAL_MIC;
+ else if (node_type.find("FRONT_MIC") != std::string::npos)
+ return AUDIO_TYPE_FRONT_MIC;
+ else if (node_type.find("REAR_MIC") != std::string::npos)
+ return AUDIO_TYPE_REAR_MIC;
else if (node_type.find("KEYBOARD_MIC") != std::string::npos)
return AUDIO_TYPE_KEYBOARD_MIC;
else if (node_type.find("MIC") != std::string::npos)
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698