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

Unified Diff: media/audio/linux/audio_manager_linux.cc

Issue 8491044: Link things together and enable the device selection for linux and mac. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fixing unittests Created 9 years, 1 month 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: media/audio/linux/audio_manager_linux.cc
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
index d6704fe386f2864b24dd07680132e2d7a1afa5fb..03e129d65c212492165ec307ff7b559bc4ed4b7e 100644
--- a/media/audio/linux/audio_manager_linux.cc
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -36,7 +36,6 @@ static const char* kInvalidAudioInputDevices[] = {
"null",
"pulse",
"dmix",
- "surround",
scherkus (not reviewing) 2011/11/16 01:20:40 ??
no longer working on chromium 2011/11/16 17:45:48 We would like to strip out all the surround device
};
// Implementation of AudioManager.
@@ -87,7 +86,7 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream(
}
AudioInputStream* AudioManagerLinux::MakeAudioInputStream(
- const AudioParameters& params) {
+ const AudioParameters& params, const std::string& device_uid) {
if (!params.IsValid() || params.channels > kMaxInputChannels)
return NULL;
@@ -100,8 +99,11 @@ AudioInputStream* AudioManagerLinux::MakeAudioInputStream(
if (!initialized())
return NULL;
- // TODO(xians): Pass the device name From AudioInputController instead.
- std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice;
+ std::string device_name;
+ if ((device_uid == AudioManagerBase::kDefaultDeviceId) || device_uid.empty())
+ device_name = AlsaPcmInputStream::kAutoSelectDevice;
+ else
+ device_name = device_uid;
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) {
device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kAlsaInputDevice);
@@ -183,7 +185,8 @@ void AudioManagerLinux::GetAudioInputDeviceNames(
// 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, "0"));
+ AudioManagerBase::kDefaultDeviceName,
+ AudioManagerBase::kDefaultDeviceId));
}
}
@@ -256,13 +259,16 @@ void AudioManagerLinux::GetAlsaDevicesInfo(
}
bool AudioManagerLinux::IsAlsaDeviceAvailable(const char* device_name) {
+ static const char kNotWantedSurroundDevices[] = "surround";
+
if (!device_name)
return false;
// Check if the device is in the list of invalid devices.
for (size_t i = 0; i < arraysize(kInvalidAudioInputDevices); ++i) {
- if (!strncmp(kInvalidAudioInputDevices[i], device_name,
- strlen(kInvalidAudioInputDevices[i])))
+ if (!strcmp(kInvalidAudioInputDevices[i], device_name) ||
+ !strncmp(kNotWantedSurroundDevices, device_name,
+ arraysize(kNotWantedSurroundDevices) -1))
scherkus (not reviewing) 2011/11/16 01:20:40 nit space between -1
no longer working on chromium 2011/11/16 17:45:48 Done.
return false;
}

Powered by Google App Engine
This is Rietveld 408576698