Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Software adjust volume of samples, allows each audio stream its own | 5 // Software adjust volume of samples, allows each audio stream its own |
| 6 // volume without impacting master volume for chrome and other applications. | 6 // volume without impacting master volume for chrome and other applications. |
| 7 | 7 |
| 8 // Implemented as templates to allow 8, 16 and 32 bit implementations. | 8 // Implemented as templates to allow 8, 16 and 32 bit implementations. |
| 9 // 8 bit is unsigned and biased by 128. | 9 // 8 bit is unsigned and biased by 128. |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 return 48000; | 130 return 48000; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Hardware sample-rate on Windows can be configured, so we must query. | 133 // Hardware sample-rate on Windows can be configured, so we must query. |
| 134 // TODO(henrika): improve possibility to specify an audio endpoint. | 134 // TODO(henrika): improve possibility to specify an audio endpoint. |
| 135 // Use the default device (same as for Wave) for now to be compatible. | 135 // Use the default device (same as for Wave) for now to be compatible. |
| 136 return WASAPIAudioOutputStream::HardwareSampleRate(); | 136 return WASAPIAudioOutputStream::HardwareSampleRate(); |
| 137 #elif defined(OS_ANDROID) | 137 #elif defined(OS_ANDROID) |
| 138 return 16000; | 138 return 16000; |
| 139 #else | 139 #else |
| 140 // Hardware for Linux is nearly always 48KHz. | |
| 141 // TODO(crogers) : return correct value in rare non-48KHz cases. | |
| 142 return 48000; | 140 return 48000; |
| 143 #endif | 141 #endif |
| 144 } | 142 } |
| 145 | 143 |
| 146 int GetAudioInputHardwareSampleRate(const std::string& device_id) { | 144 int GetAudioInputHardwareSampleRate(const std::string& device_id) { |
| 147 // TODO(henrika): add support for device selection on all platforms. | 145 // TODO(henrika): add support for device selection on all platforms. |
| 148 // Only exists on Windows today. | 146 // Only exists on Windows today. |
| 149 #if defined(OS_MACOSX) | 147 #if defined(OS_MACOSX) |
| 150 return AUAudioInputStream::HardwareSampleRate(); | 148 return AUAudioInputStream::HardwareSampleRate(); |
| 151 #elif defined(OS_WIN) | 149 #elif defined(OS_WIN) |
| 152 if (!CoreAudioUtil::IsSupported()) { | 150 if (!CoreAudioUtil::IsSupported()) { |
| 153 return 48000; | 151 return 48000; |
| 154 } | 152 } |
| 155 return WASAPIAudioInputStream::HardwareSampleRate(device_id); | 153 return WASAPIAudioInputStream::HardwareSampleRate(device_id); |
| 156 #elif defined(OS_ANDROID) | 154 #elif defined(OS_ANDROID) |
| 157 return 16000; | 155 return 16000; |
| 158 #else | 156 #else |
| 157 // Hardware for Linux is nearly always 48KHz. | |
| 158 // TODO(crogers) : return correct value in rare non-48KHz cases. | |
|
scherkus (not reviewing)
2013/02/14 00:51:35
did you mean to move this comment?
no longer working on chromium
2013/02/14 11:36:07
Yes, but not by this CL, it will be done in a foll
| |
| 159 return 48000; | 159 return 48000; |
| 160 #endif | 160 #endif |
| 161 } | 161 } |
| 162 | 162 |
| 163 size_t GetAudioHardwareBufferSize() { | 163 size_t GetAudioHardwareBufferSize() { |
| 164 int user_buffer_size = GetUserBufferSize(); | 164 int user_buffer_size = GetUserBufferSize(); |
| 165 if (user_buffer_size) | 165 if (user_buffer_size) |
| 166 return user_buffer_size; | 166 return user_buffer_size; |
| 167 | 167 |
| 168 // The sizes here were determined by experimentation and are roughly | 168 // The sizes here were determined by experimentation and are roughly |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 // out performance was degraded compared to XP. | 277 // out performance was degraded compared to XP. |
| 278 // - The regression was fixed in Windows 7 and most configurations will work | 278 // - The regression was fixed in Windows 7 and most configurations will work |
| 279 // with 2, but some (e.g., some Sound Blasters) still need 3. | 279 // with 2, but some (e.g., some Sound Blasters) still need 3. |
| 280 // - Some XP configurations (even multi-processor ones) also need 3. | 280 // - Some XP configurations (even multi-processor ones) also need 3. |
| 281 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; | 281 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; |
| 282 } | 282 } |
| 283 | 283 |
| 284 #endif | 284 #endif |
| 285 | 285 |
| 286 } // namespace media | 286 } // namespace media |
| OLD | NEW |