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 10 matching lines...) Expand all Loading... |
21 #include "base/shared_memory.h" | 21 #include "base/shared_memory.h" |
22 #include "base/time.h" | 22 #include "base/time.h" |
23 #include "media/audio/audio_parameters.h" | 23 #include "media/audio/audio_parameters.h" |
24 #include "media/audio/audio_util.h" | 24 #include "media/audio/audio_util.h" |
25 | 25 |
26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
27 #include "media/audio/mac/audio_low_latency_input_mac.h" | 27 #include "media/audio/mac/audio_low_latency_input_mac.h" |
28 #include "media/audio/mac/audio_low_latency_output_mac.h" | 28 #include "media/audio/mac/audio_low_latency_output_mac.h" |
29 #elif defined(OS_WIN) | 29 #elif defined(OS_WIN) |
30 #include "base/command_line.h" | 30 #include "base/command_line.h" |
31 #include "base/sys_info.h" | |
32 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
33 #include "media/audio/audio_manager_base.h" | 32 #include "media/audio/audio_manager_base.h" |
34 #include "media/audio/win/audio_low_latency_input_win.h" | 33 #include "media/audio/win/audio_low_latency_input_win.h" |
35 #include "media/audio/win/audio_low_latency_output_win.h" | 34 #include "media/audio/win/audio_low_latency_output_win.h" |
36 #include "media/base/media_switches.h" | 35 #include "media/base/media_switches.h" |
37 #endif | 36 #endif |
38 | 37 |
39 using base::subtle::Atomic32; | 38 using base::subtle::Atomic32; |
40 | 39 |
41 const uint32 kUnknownDataSize = static_cast<uint32>(-1); | 40 const uint32 kUnknownDataSize = static_cast<uint32>(-1); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 534 |
536 #if defined(OS_WIN) | 535 #if defined(OS_WIN) |
537 | 536 |
538 bool IsWASAPISupported() { | 537 bool IsWASAPISupported() { |
539 // Note: that function correctly returns that Windows Server 2003 does not | 538 // Note: that function correctly returns that Windows Server 2003 does not |
540 // support WASAPI. | 539 // support WASAPI. |
541 return base::win::GetVersion() >= base::win::VERSION_VISTA; | 540 return base::win::GetVersion() >= base::win::VERSION_VISTA; |
542 } | 541 } |
543 | 542 |
544 int NumberOfWaveOutBuffers() { | 543 int NumberOfWaveOutBuffers() { |
545 // The entire Windows audio stack was rewritten for Windows Vista, and the | 544 // Use 4 buffers for Vista, 3 for everyone else: |
546 // wave out API is simulated on top of new API, so there is noticeable | 545 // - The entire Windows audio stack was rewritten for Windows Vista and wave |
547 // performance degradation compared to Windows XP. So use 4 buffers for Vista. | 546 // out performance was degraded compared to XP. |
548 if (base::win::GetVersion() == base::win::VERSION_VISTA) | 547 // - The regression was fixed in Windows 7 and most configurations will work |
549 return 4; | 548 // with 2, but some (e.g., some Sound Blasters) still need 3. |
550 | 549 // - Some XP configurations (even multi-processor ones) also need 3. |
551 // Part of regression was apparently fixed in Windows 7, but problems remain | 550 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; |
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) | |
555 return 3; | |
556 | |
557 // Otherwise (for XP), use 3 buffers on single-core systems and 2 otherwise. | |
558 return (base::SysInfo::NumberOfProcessors() < 2) ? 3 : 2; | |
559 } | 551 } |
560 | 552 |
561 #endif | 553 #endif |
562 | 554 |
563 } // namespace media | 555 } // namespace media |
OLD | NEW |