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