| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Define bounds for the output buffer size. | 42 // Define bounds for the output buffer size. |
| 43 const int kMinimumOutputBufferSize = 512; | 43 const int kMinimumOutputBufferSize = 512; |
| 44 const int kMaximumOutputBufferSize = 8192; | 44 const int kMaximumOutputBufferSize = 8192; |
| 45 | 45 |
| 46 // Default input buffer size. | 46 // Default input buffer size. |
| 47 const int kDefaultInputBufferSize = 1024; | 47 const int kDefaultInputBufferSize = 1024; |
| 48 | 48 |
| 49 const char kBeamformingOnDeviceId[] = "default-beamforming-on"; | 49 const char kBeamformingOnDeviceId[] = "default-beamforming-on"; |
| 50 const char kBeamformingOffDeviceId[] = "default-beamforming-off"; | 50 const char kBeamformingOffDeviceId[] = "default-beamforming-off"; |
| 51 | 51 |
| 52 const char kAudioManagerName[] = "CRAS"; |
| 53 |
| 52 enum CrosBeamformingDeviceState { | 54 enum CrosBeamformingDeviceState { |
| 53 BEAMFORMING_DEFAULT_ENABLED = 0, | 55 BEAMFORMING_DEFAULT_ENABLED = 0, |
| 54 BEAMFORMING_USER_ENABLED, | 56 BEAMFORMING_USER_ENABLED, |
| 55 BEAMFORMING_DEFAULT_DISABLED, | 57 BEAMFORMING_DEFAULT_DISABLED, |
| 56 BEAMFORMING_USER_DISABLED, | 58 BEAMFORMING_USER_DISABLED, |
| 57 BEAMFORMING_STATE_MAX = BEAMFORMING_USER_DISABLED | 59 BEAMFORMING_STATE_MAX = BEAMFORMING_USER_DISABLED |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 void RecordBeamformingDeviceState(CrosBeamformingDeviceState state) { | 62 void RecordBeamformingDeviceState(CrosBeamformingDeviceState state) { |
| 61 UMA_HISTOGRAM_ENUMERATION("Media.CrosBeamformingDeviceState", state, | 63 UMA_HISTOGRAM_ENUMERATION("Media.CrosBeamformingDeviceState", state, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } else if (device_id == beamforming_off_device_id_) { | 223 } else if (device_id == beamforming_off_device_id_) { |
| 222 if (!IsBeamformingDefaultEnabled()) | 224 if (!IsBeamformingDefaultEnabled()) |
| 223 RecordBeamformingDeviceState(BEAMFORMING_DEFAULT_DISABLED); | 225 RecordBeamformingDeviceState(BEAMFORMING_DEFAULT_DISABLED); |
| 224 else | 226 else |
| 225 RecordBeamformingDeviceState(BEAMFORMING_USER_DISABLED); | 227 RecordBeamformingDeviceState(BEAMFORMING_USER_DISABLED); |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 return params; | 230 return params; |
| 229 } | 231 } |
| 230 | 232 |
| 233 const char* AudioManagerCras::GetName() { |
| 234 return kAudioManagerName; |
| 235 } |
| 236 |
| 231 AudioOutputStream* AudioManagerCras::MakeLinearOutputStream( | 237 AudioOutputStream* AudioManagerCras::MakeLinearOutputStream( |
| 232 const AudioParameters& params, | 238 const AudioParameters& params, |
| 233 const LogCallback& log_callback) { | 239 const LogCallback& log_callback) { |
| 234 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); | 240 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |
| 235 return MakeOutputStream(params); | 241 return MakeOutputStream(params); |
| 236 } | 242 } |
| 237 | 243 |
| 238 AudioOutputStream* AudioManagerCras::MakeLowLatencyOutputStream( | 244 AudioOutputStream* AudioManagerCras::MakeLowLatencyOutputStream( |
| 239 const AudioParameters& params, | 245 const AudioParameters& params, |
| 240 const std::string& device_id, | 246 const std::string& device_id, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 case 24: | 312 case 24: |
| 307 return SND_PCM_FORMAT_S24; | 313 return SND_PCM_FORMAT_S24; |
| 308 case 32: | 314 case 32: |
| 309 return SND_PCM_FORMAT_S32; | 315 return SND_PCM_FORMAT_S32; |
| 310 default: | 316 default: |
| 311 return SND_PCM_FORMAT_UNKNOWN; | 317 return SND_PCM_FORMAT_UNKNOWN; |
| 312 } | 318 } |
| 313 } | 319 } |
| 314 | 320 |
| 315 } // namespace media | 321 } // namespace media |
| OLD | NEW |