Index: media/audio/audio_util.cc |
=================================================================== |
--- media/audio/audio_util.cc (revision 142383) |
+++ media/audio/audio_util.cc (working copy) |
@@ -21,6 +21,7 @@ |
#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 |
@@ -519,6 +520,20 @@ |
return base::win::GetVersion() >= base::win::VERSION_VISTA; |
} |
+int NumberOfWaveOutBuffers() { |
+ // Simple heuristic: use 3 buffers on single-core system or on Vista, |
+ // 2 otherwise. |
+ // Entire Windows audio stack was rewritten for Windows Vista, and wave out |
+ // API is simulated on top of new API, so there is noticeable performance |
+ // degradation compared to Windows XP. Part of regression was fixed in |
+ // Windows 7. Maybe it is fixed in Vista Serice Pack, but let's be cautious. |
+ if ((base::SysInfo::NumberOfProcessors() < 2) || |
+ (base::win::GetVersion() == base::win::VERSION_VISTA)) { |
+ return 3; |
+ } |
+ return 2; |
+} |
+ |
#endif |
} // namespace media |