Chromium Code Reviews| Index: media/audio/audio_util.cc |
| diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc |
| index 4035d28a589fa4737cee6b1b5561fcca3a02f443..a32167e1dd8f35b7e003e21c918da22215641028 100644 |
| --- a/media/audio/audio_util.cc |
| +++ b/media/audio/audio_util.cc |
| @@ -20,20 +20,20 @@ |
| #include "base/logging.h" |
| #include "base/shared_memory.h" |
| #include "base/time.h" |
| -#if defined(OS_WIN) |
| -#include "base/sys_info.h" |
| -#include "base/win/windows_version.h" |
| -#include "media/audio/audio_manager_base.h" |
| -#endif |
| #include "media/audio/audio_parameters.h" |
| #include "media/audio/audio_util.h" |
| + |
| #if defined(OS_MACOSX) |
| #include "media/audio/mac/audio_low_latency_input_mac.h" |
| #include "media/audio/mac/audio_low_latency_output_mac.h" |
| -#endif |
| -#if defined(OS_WIN) |
| +#elif defined(OS_WIN) |
| +#include "base/command_line.h" |
| +#include "base/sys_info.h" |
| +#include "base/win/windows_version.h" |
| #include "media/audio/win/audio_low_latency_input_win.h" |
| #include "media/audio/win/audio_low_latency_output_win.h" |
| +#include "media/base/media_switches.h" |
| +#include "media/audio/audio_manager_base.h" |
| #endif |
| using base::subtle::Atomic32; |
| @@ -351,10 +351,15 @@ int GetAudioHardwareSampleRate() { |
| return 48000; |
| } |
| - // Hardware sample-rate on Windows can be configured, so we must query. |
| - // TODO(henrika): improve possibility to specify audio endpoint. |
| - // Use the default device (same as for Wave) for now to be compatible. |
| - return WASAPIAudioOutputStream::HardwareSampleRate(eConsole); |
| + const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| + if (!cmd_line->HasSwitch(switches::kEnableExclusiveMode)) { |
|
scherkus (not reviewing)
2012/06/28 00:04:41
doh rietveld swallowed my comment from the last PS
henrika (OOO until Aug 14)
2012/07/25 11:18:22
Point taken. Will improve in an upcoming version.
|
| + // Hardware sample-rate on Windows can be configured, so we must query. |
| + // TODO(henrika): improve possibility to specify audio endpoint. |
| + // Use the default device (same as for Wave) for now to be compatible. |
| + return WASAPIAudioOutputStream::HardwareSampleRate(eConsole); |
|
scherkus (not reviewing)
2012/06/28 00:04:41
I also noticed that all current usage for E_ROLE i
henrika (OOO until Aug 14)
2012/07/25 11:18:22
It is not so simple to fix. We have a better solut
|
| + } else { |
| + return 44100; |
|
scherkus (not reviewing)
2012/06/28 00:04:41
where is 44100 coming from?
for example we seem t
henrika (OOO until Aug 14)
2012/07/25 11:18:22
Rewrote this section and added new comments to mak
|
| + } |
| #elif defined(OS_ANDROID) |
| return 16000; |
| #else |
| @@ -397,6 +402,15 @@ size_t GetAudioHardwareBufferSize() { |
| // and assume 48kHz as default sample rate. |
| return 2048; |
| } |
| + |
| + // TODO(croger): tune this size to best possible WebAudio performance. |
|
scherkus (not reviewing)
2012/06/28 00:04:41
s/croger/crogers
henrika (OOO until Aug 14)
2012/07/25 11:18:22
Done.
|
| + // WebRTC always uses 480 for Windows and does not call this method. |
| + // Note that exclusive mode is experimental. |
| + const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| + if (cmd_line->HasSwitch(switches::kEnableExclusiveMode)) { |
| + return 256; |
| + } |
| + |
| // This call must be done on a COM thread configured as MTA. |
| // TODO(tommi): http://code.google.com/p/chromium/issues/detail?id=103835. |
| int mixing_sample_rate = |