| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // the lowest value (for low latency) that still allowed glitch-free | 250 // the lowest value (for low latency) that still allowed glitch-free |
| 251 // audio under high loads. | 251 // audio under high loads. |
| 252 // | 252 // |
| 253 // For Mac OS X and Windows the chromium audio backend uses a low-latency | 253 // For Mac OS X and Windows the chromium audio backend uses a low-latency |
| 254 // Core Audio API, so a low buffer size is possible. For Linux, further | 254 // Core Audio API, so a low buffer size is possible. For Linux, further |
| 255 // tuning may be needed. | 255 // tuning may be needed. |
| 256 #if defined(OS_MACOSX) | 256 #if defined(OS_MACOSX) |
| 257 return 128; | 257 return 128; |
| 258 #elif defined(OS_WIN) | 258 #elif defined(OS_WIN) |
| 259 // Buffer size to use when a proper size can't be determined from the system. | 259 // Buffer size to use when a proper size can't be determined from the system. |
| 260 static const int kFallbackBufferSize = 4096; | 260 static const int kFallbackBufferSize = 2048; |
| 261 | 261 |
| 262 if (!CoreAudioUtil::IsSupported()) { | 262 if (!CoreAudioUtil::IsSupported()) { |
| 263 // Fall back to Windows Wave implementation on Windows XP or lower | 263 // Fall back to Windows Wave implementation on Windows XP or lower |
| 264 // and assume 48kHz as default sample rate. | 264 // and assume 48kHz as default sample rate. |
| 265 return kFallbackBufferSize; | 265 return kFallbackBufferSize; |
| 266 } | 266 } |
| 267 | 267 |
| 268 // TODO(crogers): tune this size to best possible WebAudio performance. | 268 // TODO(crogers): tune this size to best possible WebAudio performance. |
| 269 // WebRTC always uses 10ms for Windows and does not call this method. | 269 // WebRTC always uses 10ms for Windows and does not call this method. |
| 270 // Note that exclusive mode is experimental. | 270 // Note that exclusive mode is experimental. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // out performance was degraded compared to XP. | 376 // out performance was degraded compared to XP. |
| 377 // - The regression was fixed in Windows 7 and most configurations will work | 377 // - The regression was fixed in Windows 7 and most configurations will work |
| 378 // with 2, but some (e.g., some Sound Blasters) still need 3. | 378 // with 2, but some (e.g., some Sound Blasters) still need 3. |
| 379 // - Some XP configurations (even multi-processor ones) also need 3. | 379 // - Some XP configurations (even multi-processor ones) also need 3. |
| 380 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; | 380 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; |
| 381 } | 381 } |
| 382 | 382 |
| 383 #endif | 383 #endif |
| 384 | 384 |
| 385 } // namespace media | 385 } // namespace media |
| OLD | NEW |