summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 10:07:35 +0000
committerxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 10:07:35 +0000
commit308f9ed0206449df6f988f90bff1092f8d61e939 (patch)
treebab3e4168203b387c3c3e6befbfb1eafe0f35155 /media
parente8c12c132f512fde53428aad390f427c29072721 (diff)
downloadchromium_src-308f9ed0206449df6f988f90bff1092f8d61e939.zip
chromium_src-308f9ed0206449df6f988f90bff1092f8d61e939.tar.gz
chromium_src-308f9ed0206449df6f988f90bff1092f8d61e939.tar.bz2
Add the "default" device to the device list as long as it detects the hardware.
BUG=117162 TEST=media_unittests Review URL: http://codereview.chromium.org/9621006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/linux/audio_manager_linux.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
index 3af14b2..faf9300 100644
--- a/media/audio/linux/audio_manager_linux.cc
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -86,18 +86,7 @@ void AudioManagerLinux::ShowAudioInputSettings() {
void AudioManagerLinux::GetAudioInputDeviceNames(
media::AudioDeviceNames* device_names) {
DCHECK(device_names->empty());
-
GetAlsaAudioInputDevices(device_names);
-
- if (!device_names->empty()) {
- // Prepend the default device to the list since we always want it to be
- // on the top of the list for all platforms. There is no duplicate
- // counting here since the default device has been abstracted out before.
- // We use index 0 to make up the unique_id to identify the default device.
- device_names->push_front(media::AudioDeviceName(
- AudioManagerBase::kDefaultDeviceName,
- AudioManagerBase::kDefaultDeviceId));
- }
}
void AudioManagerLinux::GetAlsaAudioInputDevices(
@@ -137,6 +126,17 @@ void AudioManagerLinux::GetAlsaDevicesInfo(
if (io != NULL && strcmp(kOutputDevice, io.get()) == 0)
continue;
+ // Found an input device, prepend the default device since we always want
+ // it to be on the top of the list for all platforms. And there is no
+ // duplicate counting here since it is only done if the list is still empty.
+ // Note, pulse has exclusively opened the default device, so we must open
+ // the device via the "default" moniker.
+ if (device_names->empty()) {
+ device_names->push_front(media::AudioDeviceName(
+ AudioManagerBase::kDefaultDeviceName,
+ AudioManagerBase::kDefaultDeviceId));
+ }
+
// Get the unique device name for the device.
scoped_ptr_malloc<char> unique_device_name(
wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName));