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

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: update 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..01e177b16d01254a2158f79d9144bc0ad7907e7d 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",
henrika (OOO until Aug 14) 2011/11/17 11:26:15 Related to this CL?
no longer working on chromium 2011/11/17 14:15:26 Yes, I have already explained offline.
};
// Implementation of AudioManager.
@@ -87,7 +86,7 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream(
}
AudioInputStream* AudioManagerLinux::MakeAudioInputStream(
- const AudioParameters& params) {
+ const AudioParameters& params, const std::string& device_id) {
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_id == AudioManagerBase::kDefaultDeviceId)
tommi (sloooow) - chröme 2011/11/17 10:24:16 When checking the device id, in some places, we us
no longer working on chromium 2011/11/17 14:15:26 Done.
+ device_name = AlsaPcmInputStream::kAutoSelectDevice;
+ else
+ device_name = device_id;
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) ||
tommi (sloooow) - chröme 2011/11/17 10:24:16 nit: prefer strcmp() == 0 rather than !strcmp() fo
no longer working on chromium 2011/11/17 14:15:26 Done.
+ !strncmp(kNotWantedSurroundDevices, device_name,
+ arraysize(kNotWantedSurroundDevices) - 1))
return false;
}

Powered by Google App Engine
This is Rietveld 408576698