Index: media/audio/audio_util.cc |
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc |
index 4c446dd8012bb1e9cb1d45ac119aa0c3d1341f3e..94490576caa015b6ea11826a4a9148a6ca2d27ed 100644 |
--- a/media/audio/audio_util.cc |
+++ b/media/audio/audio_util.cc |
@@ -242,6 +242,8 @@ int GetAudioInputHardwareSampleRate(const std::string& device_id) { |
} |
size_t GetAudioHardwareBufferSize() { |
+ // TODO(henrika): resolve conflict on Windows where we today only allow |
tommi (sloooow) - chröme
2013/01/31 13:42:08
Move this todo into the OS_WIN section?
Also, can
henrika (OOO until Aug 14)
2013/01/31 14:29:38
Done.
|
+ // the native buffer size. |
int user_buffer_size = GetUserBufferSize(); |
if (user_buffer_size) |
return user_buffer_size; |
@@ -257,7 +259,7 @@ size_t GetAudioHardwareBufferSize() { |
return 128; |
#elif defined(OS_WIN) |
// Buffer size to use when a proper size can't be determined from the system. |
- static const int kFallbackBufferSize = 4096; |
+ static const int kFallbackBufferSize = 1440; |
DaleCurtis
2013/01/31 02:34:33
Hmm, this is going to bust XP. If WaveOut isn't su
henrika (OOO until Aug 14)
2013/01/31 14:29:38
I hope you did not think I meant to do this change
|
if (!CoreAudioUtil::IsSupported()) { |
// Fall back to Windows Wave implementation on Windows XP or lower |
@@ -273,42 +275,10 @@ size_t GetAudioHardwareBufferSize() { |
return 256; |
} |
- // TODO(henrika): remove when the --enable-webaudio-input flag is no longer |
- // utilized. |
- if (cmd_line->HasSwitch(switches::kEnableWebAudioInput)) { |
- AudioParameters params; |
- HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters(eRender, eConsole, |
- ¶ms); |
- return FAILED(hr) ? kFallbackBufferSize : params.frames_per_buffer(); |
- } |
- |
- // 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 = |
- WASAPIAudioOutputStream::HardwareSampleRate(eConsole); |
- |
- // Windows will return a sample rate of 0 when no audio output is available |
- // (i.e. via RemoteDesktop with remote audio disabled), but we should never |
- // return a buffer size of zero. |
- if (mixing_sample_rate == 0) |
- return kFallbackBufferSize; |
- |
- // Use different buffer sizes depening on the sample rate . The existing |
- // WASAPI implementation is tuned to provide the most stable callback |
- // sequence using these combinations. |
- if (mixing_sample_rate % 11025 == 0) |
- // Use buffer size of ~10.15873 ms. |
- return (112 * (mixing_sample_rate / 11025)); |
- |
- if (mixing_sample_rate % 8000 == 0) |
- // Use buffer size of 10ms. |
- return (80 * (mixing_sample_rate / 8000)); |
- |
- // Ensure we always return a buffer size which is somewhat appropriate. |
- LOG(ERROR) << "Unknown sample rate " << mixing_sample_rate << " detected."; |
- if (mixing_sample_rate > limits::kMinSampleRate) |
- return (mixing_sample_rate / 100); |
- return kFallbackBufferSize; |
+ AudioParameters params; |
+ HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters(eRender, eConsole, |
+ ¶ms); |
+ return FAILED(hr) ? kFallbackBufferSize : params.frames_per_buffer(); |
#else |
return 2048; |
#endif |