| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/alsa/audio_manager_alsa.h" | 5 #include "media/audio/alsa/audio_manager_alsa.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 *hint_iter, kIoHintName)); | 156 *hint_iter, kIoHintName)); |
| 157 if (io != NULL && strcmp(unwanted_device_type, io.get()) == 0) | 157 if (io != NULL && strcmp(unwanted_device_type, io.get()) == 0) |
| 158 continue; | 158 continue; |
| 159 | 159 |
| 160 // Found a device, prepend the default device since we always want | 160 // Found a device, prepend the default device since we always want |
| 161 // it to be on the top of the list for all platforms. And there is | 161 // it to be on the top of the list for all platforms. And there is |
| 162 // no duplicate counting here since it is only done if the list is | 162 // no duplicate counting here since it is only done if the list is |
| 163 // still empty. Note, pulse has exclusively opened the default | 163 // still empty. Note, pulse has exclusively opened the default |
| 164 // device, so we must open the device via the "default" moniker. | 164 // device, so we must open the device via the "default" moniker. |
| 165 if (device_names->empty()) { | 165 if (device_names->empty()) { |
| 166 device_names->push_front(media::AudioDeviceName( | 166 device_names->push_front( |
| 167 AudioManagerBase::kDefaultDeviceName, | 167 media::AudioDeviceName(AudioManager::GetDefaultDeviceName(), |
| 168 AudioManagerBase::kDefaultDeviceId)); | 168 AudioManagerBase::kDefaultDeviceId)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Get the unique device name for the device. | 171 // Get the unique device name for the device. |
| 172 scoped_ptr<char, base::FreeDeleter> unique_device_name( | 172 scoped_ptr<char, base::FreeDeleter> unique_device_name( |
| 173 wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); | 173 wrapper_->DeviceNameGetHint(*hint_iter, kNameHintName)); |
| 174 | 174 |
| 175 // Find out if the device is available. | 175 // Find out if the device is available. |
| 176 if (IsAlsaDeviceAvailable(type, unique_device_name.get())) { | 176 if (IsAlsaDeviceAvailable(type, unique_device_name.get())) { |
| 177 // Get the description for the device. | 177 // Get the description for the device. |
| 178 scoped_ptr<char, base::FreeDeleter> desc(wrapper_->DeviceNameGetHint( | 178 scoped_ptr<char, base::FreeDeleter> desc(wrapper_->DeviceNameGetHint( |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 349 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 350 switches::kAlsaInputDevice)) { | 350 switches::kAlsaInputDevice)) { |
| 351 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 351 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 352 switches::kAlsaInputDevice); | 352 switches::kAlsaInputDevice); |
| 353 } | 353 } |
| 354 | 354 |
| 355 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 355 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace media | 358 } // namespace media |
| OLD | NEW |