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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 #if defined(OS_WIN) | 536 #if defined(OS_WIN) |
537 | 537 |
538 bool IsWASAPISupported() { | 538 bool IsWASAPISupported() { |
539 // Note: that function correctly returns that Windows Server 2003 does not | 539 // Note: that function correctly returns that Windows Server 2003 does not |
540 // support WASAPI. | 540 // support WASAPI. |
541 return base::win::GetVersion() >= base::win::VERSION_VISTA; | 541 return base::win::GetVersion() >= base::win::VERSION_VISTA; |
542 } | 542 } |
543 | 543 |
544 int NumberOfWaveOutBuffers() { | 544 int NumberOfWaveOutBuffers() { |
545 // Simple heuristic: use 3 buffers on single-core system or on Vista, | 545 // The entire Windows audio stack was rewritten for Windows Vista, and the |
546 // 2 otherwise. | 546 // wave out API is simulated on top of new API, so there is noticeable |
547 // Entire Windows audio stack was rewritten for Windows Vista, and wave out | 547 // performance degradation compared to Windows XP. So use 4 buffers for Vista. |
548 // API is simulated on top of new API, so there is noticeable performance | 548 if (base::win::GetVersion() == base::win::VERSION_VISTA) |
549 // degradation compared to Windows XP. Part of regression was apparently fixed | 549 return 4; |
550 // in Windows 7, but problems remain at least with some configurations. | 550 |
551 if ((base::SysInfo::NumberOfProcessors() < 2) || | 551 // Part of regression was apparently fixed in Windows 7, but problems remain |
552 (base::win::GetVersion() >= base::win::VERSION_VISTA)) { | 552 // at least with some configurations (compared to XP). So use 3 buffers for |
| 553 // Windows 7 and higher. |
| 554 if (base::win::GetVersion() >= base::win::VERSION_WIN7) |
553 return 3; | 555 return 3; |
554 } | 556 |
555 return 2; | 557 // Otherwise (for XP), use 3 buffers on single-core systems and 2 otherwise. |
| 558 return (base::SysInfo::NumberOfProcessors() < 2) ? 3 : 2; |
556 } | 559 } |
557 | 560 |
558 #endif | 561 #endif |
559 | 562 |
560 } // namespace media | 563 } // namespace media |
OLD | NEW |