summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/audio/audio_util.cc8
-rw-r--r--media/base/media_switches.cc4
-rw-r--r--media/base/media_switches.h4
3 files changed, 16 insertions, 0 deletions
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc
index 3b4f9c5..c03f502 100644
--- a/media/audio/audio_util.cc
+++ b/media/audio/audio_util.cc
@@ -262,6 +262,14 @@ size_t GetHighLatencyOutputBufferSize(int sample_rate) {
#if defined(OS_WIN)
int NumberOfWaveOutBuffers() {
+ // Use the user provided buffer count if provided.
+ int buffers = 0;
+ std::string buffers_str(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kWaveOutBuffers));
+ if (base::StringToInt(buffers_str, &buffers) && buffers > 0) {
+ return buffers;
+ }
+
// Use 4 buffers for Vista, 3 for everyone else:
// - The entire Windows audio stack was rewritten for Windows Vista and wave
// out performance was degraded compared to XP.
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
index f113161..79f077a 100644
--- a/media/base/media_switches.cc
+++ b/media/base/media_switches.cc
@@ -66,4 +66,8 @@ const char kEnableVp9Playback[] = "enable-vp9-playback";
// with WebRTC apps for audio mirroring testing.
const char kForceAudioMirroring[] = "force-audio-mirroring";
+#if defined(OS_WIN)
+const char kWaveOutBuffers[] = "waveout-buffers";
+#endif
+
} // namespace switches
diff --git a/media/base/media_switches.h b/media/base/media_switches.h
index de493c0e..7460a92 100644
--- a/media/base/media_switches.h
+++ b/media/base/media_switches.h
@@ -51,6 +51,10 @@ MEDIA_EXPORT extern const char kEnableVp9Playback[];
MEDIA_EXPORT extern const char kForceAudioMirroring[];
+#if defined(OS_WIN)
+MEDIA_EXPORT extern const char kWaveOutBuffers[];
+#endif
+
} // namespace switches
#endif // MEDIA_BASE_MEDIA_SWITCHES_H_