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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 bool AudioManagerCras::HasAudioInputDevices() { | 149 bool AudioManagerCras::HasAudioInputDevices() { |
150 chromeos::AudioDeviceList devices; | 150 chromeos::AudioDeviceList devices; |
151 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); | 151 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); |
152 for (size_t i = 0; i < devices.size(); ++i) { | 152 for (size_t i = 0; i < devices.size(); ++i) { |
153 if (devices[i].is_input && devices[i].is_for_simple_usage()) | 153 if (devices[i].is_input && devices[i].is_for_simple_usage()) |
154 return true; | 154 return true; |
155 } | 155 } |
156 return false; | 156 return false; |
157 } | 157 } |
158 | 158 |
159 AudioManagerCras::AudioManagerCras( | 159 AudioManagerCras::AudioManagerCras(std::unique_ptr<AudioThread> audio_thread, |
160 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 160 AudioLogFactory* audio_log_factory) |
161 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 161 : AudioManagerBase(std::move(audio_thread), audio_log_factory), |
162 AudioLogFactory* audio_log_factory) | |
163 : AudioManagerBase(std::move(task_runner), | |
164 std::move(worker_task_runner), | |
165 audio_log_factory), | |
166 beamforming_on_device_id_(nullptr), | 162 beamforming_on_device_id_(nullptr), |
167 beamforming_off_device_id_(nullptr) { | 163 beamforming_off_device_id_(nullptr) { |
168 SetMaxOutputStreamsAllowed(kMaxOutputStreams); | 164 SetMaxOutputStreamsAllowed(kMaxOutputStreams); |
169 } | 165 } |
170 | 166 |
171 AudioManagerCras::~AudioManagerCras() { | 167 AudioManagerCras::~AudioManagerCras() = default; |
172 Shutdown(); | |
173 } | |
174 | 168 |
175 void AudioManagerCras::ShowAudioInputSettings() { | 169 void AudioManagerCras::ShowAudioInputSettings() { |
176 NOTIMPLEMENTED(); | 170 NOTIMPLEMENTED(); |
177 } | 171 } |
178 | 172 |
179 void AudioManagerCras::GetAudioDeviceNamesImpl(bool is_input, | 173 void AudioManagerCras::GetAudioDeviceNamesImpl(bool is_input, |
180 AudioDeviceNames* device_names) { | 174 AudioDeviceNames* device_names) { |
181 DCHECK(device_names->empty()); | 175 DCHECK(device_names->empty()); |
182 // At least two mic positions indicates we have a beamforming capable mic | 176 // At least two mic positions indicates we have a beamforming capable mic |
183 // array. Add the virtual beamforming device to the list. When this device is | 177 // array. Add the virtual beamforming device to the list. When this device is |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 363 |
370 bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) { | 364 bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) { |
371 AudioDeviceNames device_names; | 365 AudioDeviceNames device_names; |
372 GetAudioDeviceNamesImpl(is_input, &device_names); | 366 GetAudioDeviceNamesImpl(is_input, &device_names); |
373 DCHECK(!device_names.empty()); | 367 DCHECK(!device_names.empty()); |
374 const AudioDeviceName& device_name = device_names.front(); | 368 const AudioDeviceName& device_name = device_names.front(); |
375 return device_name.unique_id == device_id; | 369 return device_name.unique_id == device_id; |
376 } | 370 } |
377 | 371 |
378 } // namespace media | 372 } // namespace media |
OLD | NEW |