| 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/cras/audio_manager_cras.h" | 5 #include "media/audio/cras/audio_manager_cras.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 bool AudioManagerCras::HasAudioInputDevices() { | 127 bool AudioManagerCras::HasAudioInputDevices() { |
| 128 chromeos::AudioDeviceList devices; | 128 chromeos::AudioDeviceList devices; |
| 129 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); | 129 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); |
| 130 for (size_t i = 0; i < devices.size(); ++i) { | 130 for (size_t i = 0; i < devices.size(); ++i) { |
| 131 if (devices[i].is_input && devices[i].is_for_simple_usage()) | 131 if (devices[i].is_input && devices[i].is_for_simple_usage()) |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 | 136 |
| 137 AudioManagerCras::AudioManagerCras( | 137 AudioManagerCras::AudioManagerCras(std::unique_ptr<AudioThread> audio_thread, |
| 138 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 138 AudioLogFactory* audio_log_factory) |
| 139 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 139 : AudioManagerBase(std::move(audio_thread), audio_log_factory), |
| 140 AudioLogFactory* audio_log_factory) | |
| 141 : AudioManagerBase(std::move(task_runner), | |
| 142 std::move(worker_task_runner), | |
| 143 audio_log_factory), | |
| 144 beamforming_on_device_id_(nullptr), | 140 beamforming_on_device_id_(nullptr), |
| 145 beamforming_off_device_id_(nullptr) { | 141 beamforming_off_device_id_(nullptr) { |
| 146 SetMaxOutputStreamsAllowed(kMaxOutputStreams); | 142 SetMaxOutputStreamsAllowed(kMaxOutputStreams); |
| 147 } | 143 } |
| 148 | 144 |
| 149 AudioManagerCras::~AudioManagerCras() { | 145 AudioManagerCras::~AudioManagerCras() = default; |
| 150 Shutdown(); | |
| 151 } | |
| 152 | 146 |
| 153 void AudioManagerCras::ShowAudioInputSettings() { | 147 void AudioManagerCras::ShowAudioInputSettings() { |
| 154 NOTIMPLEMENTED(); | 148 NOTIMPLEMENTED(); |
| 155 } | 149 } |
| 156 | 150 |
| 157 void AudioManagerCras::GetAudioDeviceNamesImpl(bool is_input, | 151 void AudioManagerCras::GetAudioDeviceNamesImpl(bool is_input, |
| 158 AudioDeviceNames* device_names) { | 152 AudioDeviceNames* device_names) { |
| 159 DCHECK(device_names->empty()); | 153 DCHECK(device_names->empty()); |
| 160 // At least two mic positions indicates we have a beamforming capable mic | 154 // At least two mic positions indicates we have a beamforming capable mic |
| 161 // array. Add the virtual beamforming device to the list. When this device is | 155 // array. Add the virtual beamforming device to the list. When this device is |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 353 |
| 360 bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) { | 354 bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) { |
| 361 AudioDeviceNames device_names; | 355 AudioDeviceNames device_names; |
| 362 GetAudioDeviceNamesImpl(is_input, &device_names); | 356 GetAudioDeviceNamesImpl(is_input, &device_names); |
| 363 DCHECK(!device_names.empty()); | 357 DCHECK(!device_names.empty()); |
| 364 const AudioDeviceName& device_name = device_names.front(); | 358 const AudioDeviceName& device_name = device_names.front(); |
| 365 return device_name.unique_id == device_id; | 359 return device_name.unique_id == device_id; |
| 366 } | 360 } |
| 367 | 361 |
| 368 } // namespace media | 362 } // namespace media |
| OLD | NEW |