summaryrefslogtreecommitdiffstats
path: root/chromeos/audio
diff options
context:
space:
mode:
authorcychiang <cychiang@chromium.org>2015-07-17 07:20:43 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-17 14:21:32 +0000
commitd18fe868a83a806a64de6cf20aa3926dc4156c8f (patch)
tree4f9fb32747f0e5ef4814e742f0a4b5eb7c05799e /chromeos/audio
parent6e5b7a69a33b5364bffa55c76a08ab6fe3ee59bb (diff)
downloadchromium_src-d18fe868a83a806a64de6cf20aa3926dc4156c8f.zip
chromium_src-d18fe868a83a806a64de6cf20aa3926dc4156c8f.tar.gz
chromium_src-d18fe868a83a806a64de6cf20aa3926dc4156c8f.tar.bz2
Try to reland "Implement HasInputDevices in CrasAudioManager"
Fixed the dependency of media to chromeos:audio. Currently in CrasAudioManager, HasInputDevices always returns True. We need to let HasInputDevices reflect the truth for device without internal microphone like ChromeBox. CrasAudioManager should gets the audio devices from CrasAudioHandler and check if there is any input device of simple usage. Add a property is_for_simple_usage to AudioDeviceType to indicate that a device is for simple usage, not for special usage like loopback, always on keyword mic, or keyboard mic. This property can also replace the logic in audio_detailed_view.cc to filter out the devices that we do not want to display in UI. BUG=490851 TEST=Check audio devices in UI does not contain loopback devices. TEST=Check virtual keyboard does not show microphone for chromebox (Not tested yet). TEST=Go to https://www.google.com/intl/en/chrome/demos/speech.html and see the webpage says there is no microphone on this device. R=dalecurtis@chromium.org, derat@chromium.org, dgreid@chromium.org, jennyz@chromium.org Review URL: https://codereview.chromium.org/1186293003 Cr-Commit-Position: refs/heads/master@{#337791} Review URL: https://codereview.chromium.org/1212013005 Cr-Commit-Position: refs/heads/master@{#339248}
Diffstat (limited to 'chromeos/audio')
-rw-r--r--chromeos/audio/audio_device.h14
-rw-r--r--chromeos/audio/cras_audio_handler.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/chromeos/audio/audio_device.h b/chromeos/audio/audio_device.h
index 67dca1c..0d1b685 100644
--- a/chromeos/audio/audio_device.h
+++ b/chromeos/audio/audio_device.h
@@ -41,6 +41,20 @@ struct CHROMEOS_EXPORT AudioDevice {
static std::string GetTypeString(chromeos::AudioDeviceType type);
static chromeos::AudioDeviceType GetAudioType(const std::string& node_type);
+ // Indicates that an input or output audio device is for simple usage like
+ // playback or recording for user. In contrast, audio device such as
+ // loopback, always on keyword recognition (AOKR), and keyboard mic are
+ // not for simple usage.
+ bool is_for_simple_usage() const {
+ return (type == AUDIO_TYPE_HEADPHONE ||
+ type == AUDIO_TYPE_INTERNAL_MIC ||
+ type == AUDIO_TYPE_MIC ||
+ type == AUDIO_TYPE_USB ||
+ type == AUDIO_TYPE_BLUETOOTH ||
+ type == AUDIO_TYPE_HDMI ||
+ type == AUDIO_TYPE_INTERNAL_SPEAKER);
+ }
+
bool is_input;
uint64 id;
std::string display_name;
diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h
index 10c77a4..5d24973 100644
--- a/chromeos/audio/cras_audio_handler.h
+++ b/chromeos/audio/cras_audio_handler.h
@@ -128,6 +128,8 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer,
virtual uint64_t GetPrimaryActiveInputNode() const;
// Gets the audio devices back in |device_list|.
+ // This call can be invoked from I/O thread or UI thread because
+ // it does not need to access CrasAudioClient on DBus.
virtual void GetAudioDevices(AudioDeviceList* device_list) const;
virtual bool GetPrimaryActiveOutputDevice(AudioDevice* device) const;