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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/nix/xdg_util.h" | 12 #include "base/nix/xdg_util.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "chromeos/audio/audio_device.h" |
| 15 #include "chromeos/audio/cras_audio_handler.h" |
14 #include "media/audio/cras/cras_input.h" | 16 #include "media/audio/cras/cras_input.h" |
15 #include "media/audio/cras/cras_unified.h" | 17 #include "media/audio/cras/cras_unified.h" |
16 #include "media/base/channel_layout.h" | 18 #include "media/base/channel_layout.h" |
17 | 19 |
18 // cras_util.h headers pull in min/max macros... | 20 // cras_util.h headers pull in min/max macros... |
19 // TODO(dgreid): Fix headers such that these aren't imported. | 21 // TODO(dgreid): Fix headers such that these aren't imported. |
20 #undef min | 22 #undef min |
21 #undef max | 23 #undef max |
22 | 24 |
23 namespace media { | 25 namespace media { |
(...skipping 18 matching lines...) Expand all Loading... |
42 static const int kMaximumOutputBufferSize = 8192; | 44 static const int kMaximumOutputBufferSize = 8192; |
43 | 45 |
44 // Default input buffer size. | 46 // Default input buffer size. |
45 static const int kDefaultInputBufferSize = 1024; | 47 static const int kDefaultInputBufferSize = 1024; |
46 | 48 |
47 bool AudioManagerCras::HasAudioOutputDevices() { | 49 bool AudioManagerCras::HasAudioOutputDevices() { |
48 return true; | 50 return true; |
49 } | 51 } |
50 | 52 |
51 bool AudioManagerCras::HasAudioInputDevices() { | 53 bool AudioManagerCras::HasAudioInputDevices() { |
52 return true; | 54 chromeos::AudioDeviceList devices; |
| 55 chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); |
| 56 for (size_t i = 0; i < devices.size(); ++i) |
| 57 if (devices[i].is_input && devices[i].is_for_simple_usage()) |
| 58 return true; |
| 59 return false; |
53 } | 60 } |
54 | 61 |
55 AudioManagerCras::AudioManagerCras(AudioLogFactory* audio_log_factory) | 62 AudioManagerCras::AudioManagerCras(AudioLogFactory* audio_log_factory) |
56 : AudioManagerBase(audio_log_factory), | 63 : AudioManagerBase(audio_log_factory), |
57 has_keyboard_mic_(false) { | 64 has_keyboard_mic_(false) { |
58 SetMaxOutputStreamsAllowed(kMaxOutputStreams); | 65 SetMaxOutputStreamsAllowed(kMaxOutputStreams); |
59 } | 66 } |
60 | 67 |
61 AudioManagerCras::~AudioManagerCras() { | 68 AudioManagerCras::~AudioManagerCras() { |
62 Shutdown(); | 69 Shutdown(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 case 24: | 179 case 24: |
173 return SND_PCM_FORMAT_S24; | 180 return SND_PCM_FORMAT_S24; |
174 case 32: | 181 case 32: |
175 return SND_PCM_FORMAT_S32; | 182 return SND_PCM_FORMAT_S32; |
176 default: | 183 default: |
177 return SND_PCM_FORMAT_UNKNOWN; | 184 return SND_PCM_FORMAT_UNKNOWN; |
178 } | 185 } |
179 } | 186 } |
180 | 187 |
181 } // namespace media | 188 } // namespace media |
OLD | NEW |