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

Unified Diff: chromeos/audio/audio_device.cc

Issue 1186293003: Implement HasInputDevices in CrasAudioManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/audio_device.cc
diff --git a/chromeos/audio/audio_device.cc b/chromeos/audio/audio_device.cc
index 32012a12aa5166341069b88ee3e0efaece5a77f4..aed96ea86fe7acaf8e71f9527ab163d0171432ba 100644
--- a/chromeos/audio/audio_device.cc
+++ b/chromeos/audio/audio_device.cc
@@ -37,6 +37,15 @@ uint8 GetDevicePriority(AudioDeviceType type) {
}
}
+// Check if a node type is for simple record/playback usage.
+// Special usages like keyboard mic, AOKR, loopback are excluded.
+bool IsForSimpleUsage(AudioDeviceType type) {
+ return (type == AUDIO_TYPE_HEADPHONE || type == AUDIO_TYPE_INTERNAL_MIC ||
jennyz 2015/06/16 21:51:35 nit: How about put each type is a separate line, s
cychiang 2015/06/23 06:05:40 Done.
+ type == AUDIO_TYPE_MIC || type == AUDIO_TYPE_USB ||
+ type == AUDIO_TYPE_BLUETOOTH || type == AUDIO_TYPE_HDMI ||
+ type == AUDIO_TYPE_INTERNAL_SPEAKER);
+}
+
} // namespace
// static
@@ -101,6 +110,7 @@ AudioDeviceType AudioDevice::GetAudioType(
AudioDevice::AudioDevice()
: is_input(false),
+ is_for_simple_usage(true),
id(0),
display_name(""),
type(AUDIO_TYPE_OTHER),
jennyz 2015/06/16 21:51:35 This seems conflicting with IsForSimpleUsage(), th
cychiang 2015/06/23 06:05:40 Done.
@@ -113,6 +123,7 @@ AudioDevice::AudioDevice(const AudioNode& node) {
is_input = node.is_input;
id = node.id;
type = GetAudioType(node.type);
+ is_for_simple_usage = IsForSimpleUsage(type);
Daniel Erat 2015/06/18 14:53:20 this member is just derived from another member, t
cychiang 2015/06/23 06:05:40 Done.
if (!node.name.empty() && node.name != "(default)")
display_name = node.name;
else

Powered by Google App Engine
This is Rietveld 408576698