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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 samples * base::Time::kMillisecondsPerSecond < | 332 samples * base::Time::kMillisecondsPerSecond < |
333 sample_rate * kMillisecondsPerHardwarePacket) { | 333 sample_rate * kMillisecondsPerHardwarePacket) { |
334 samples *= 2; | 334 samples *= 2; |
335 } | 335 } |
336 return samples; | 336 return samples; |
337 } | 337 } |
338 | 338 |
339 #if defined(OS_WIN) | 339 #if defined(OS_WIN) |
340 | 340 |
341 int NumberOfWaveOutBuffers() { | 341 int NumberOfWaveOutBuffers() { |
| 342 // Use the user provided buffer count if provided. |
| 343 int buffers = 0; |
| 344 std::string buffers_str(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 345 switches::kWaveOutBuffers)); |
| 346 if (base::StringToInt(buffers_str, &buffers) && buffers > 0) { |
| 347 return buffers; |
| 348 } |
| 349 |
342 // Use 4 buffers for Vista, 3 for everyone else: | 350 // Use 4 buffers for Vista, 3 for everyone else: |
343 // - The entire Windows audio stack was rewritten for Windows Vista and wave | 351 // - The entire Windows audio stack was rewritten for Windows Vista and wave |
344 // out performance was degraded compared to XP. | 352 // out performance was degraded compared to XP. |
345 // - The regression was fixed in Windows 7 and most configurations will work | 353 // - The regression was fixed in Windows 7 and most configurations will work |
346 // with 2, but some (e.g., some Sound Blasters) still need 3. | 354 // with 2, but some (e.g., some Sound Blasters) still need 3. |
347 // - Some XP configurations (even multi-processor ones) also need 3. | 355 // - Some XP configurations (even multi-processor ones) also need 3. |
348 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; | 356 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; |
349 } | 357 } |
350 | 358 |
351 #endif | 359 #endif |
352 | 360 |
353 } // namespace media | 361 } // namespace media |
OLD | NEW |