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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 samples * base::Time::kMillisecondsPerSecond < | 364 samples * base::Time::kMillisecondsPerSecond < |
365 sample_rate * kMillisecondsPerHardwarePacket) { | 365 sample_rate * kMillisecondsPerHardwarePacket) { |
366 samples *= 2; | 366 samples *= 2; |
367 } | 367 } |
368 return samples; | 368 return samples; |
369 } | 369 } |
370 | 370 |
371 #if defined(OS_WIN) | 371 #if defined(OS_WIN) |
372 | 372 |
373 int NumberOfWaveOutBuffers() { | 373 int NumberOfWaveOutBuffers() { |
| 374 // Use the user provided buffer count if provided. |
| 375 int buffers = 0; |
| 376 std::string buffers_str(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 377 switches::kWaveOutBuffers)); |
| 378 if (base::StringToInt(buffers_str, &buffers) && buffers > 0) { |
| 379 return buffers; |
| 380 } |
| 381 |
374 // Use 4 buffers for Vista, 3 for everyone else: | 382 // Use 4 buffers for Vista, 3 for everyone else: |
375 // - The entire Windows audio stack was rewritten for Windows Vista and wave | 383 // - The entire Windows audio stack was rewritten for Windows Vista and wave |
376 // out performance was degraded compared to XP. | 384 // out performance was degraded compared to XP. |
377 // - The regression was fixed in Windows 7 and most configurations will work | 385 // - 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. | 386 // with 2, but some (e.g., some Sound Blasters) still need 3. |
379 // - Some XP configurations (even multi-processor ones) also need 3. | 387 // - Some XP configurations (even multi-processor ones) also need 3. |
380 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; | 388 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; |
381 } | 389 } |
382 | 390 |
383 #endif | 391 #endif |
384 | 392 |
385 } // namespace media | 393 } // namespace media |
OLD | NEW |