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 |
11 // TODO(vrk): This file has been running pretty wild and free, and it's likely | 11 // TODO(vrk): This file has been running pretty wild and free, and it's likely |
12 // that a lot of the functions can be simplified and made more elegant. Revisit | 12 // that a lot of the functions can be simplified and made more elegant. Revisit |
13 // after other audio cleanup is done. (crbug.com/120319) | 13 // after other audio cleanup is done. (crbug.com/120319) |
14 | 14 |
15 #include <algorithm> | 15 #include <algorithm> |
16 #include <limits> | 16 #include <limits> |
17 | 17 |
18 #include "base/atomicops.h" | 18 #include "base/atomicops.h" |
19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/shared_memory.h" | 21 #include "base/shared_memory.h" |
22 #include "base/time.h" | 22 #include "base/time.h" |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 #include "base/sys_info.h" | |
24 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
25 #include "media/audio/audio_manager_base.h" | 26 #include "media/audio/audio_manager_base.h" |
26 #endif | 27 #endif |
27 #include "media/audio/audio_parameters.h" | 28 #include "media/audio/audio_parameters.h" |
28 #include "media/audio/audio_util.h" | 29 #include "media/audio/audio_util.h" |
29 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
30 #include "media/audio/mac/audio_low_latency_input_mac.h" | 31 #include "media/audio/mac/audio_low_latency_input_mac.h" |
31 #include "media/audio/mac/audio_low_latency_output_mac.h" | 32 #include "media/audio/mac/audio_low_latency_output_mac.h" |
32 #endif | 33 #endif |
33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 } | 513 } |
513 | 514 |
514 #if defined(OS_WIN) | 515 #if defined(OS_WIN) |
515 | 516 |
516 bool IsWASAPISupported() { | 517 bool IsWASAPISupported() { |
517 // Note: that function correctly returns that Windows Server 2003 does not | 518 // Note: that function correctly returns that Windows Server 2003 does not |
518 // support WASAPI. | 519 // support WASAPI. |
519 return base::win::GetVersion() >= base::win::VERSION_VISTA; | 520 return base::win::GetVersion() >= base::win::VERSION_VISTA; |
520 } | 521 } |
521 | 522 |
523 int NumberOfWaveOutBuffers() { | |
524 // Simple heuristic: use 3 buffers on single-core system or on Vista, | |
525 // 3 otherwise. | |
scherkus (not reviewing)
2012/06/07 17:25:41
"use 3 buffers [...], 3 otherwise" ?
do you mean
enal1
2012/06/07 20:56:22
Done.
| |
526 int num_buffers = 2; | |
527 if ((base::SysInfo::NumberOfProcessors() < 2) || | |
528 (base::win::GetVersion() == base::win::VERSION_VISTA)) { | |
529 num_buffers = 3; | |
530 } | |
531 return num_buffers; | |
scherkus (not reviewing)
2012/06/07 17:25:41
nit: how about dropping the num_buffers stuff and
enal1
2012/06/07 20:56:22
Done.
| |
532 } | |
533 | |
522 #endif | 534 #endif |
523 | 535 |
524 } // namespace media | 536 } // namespace media |
OLD | NEW |