From e5d699a398be02939bba2247e2c2d6843793d6fc Mon Sep 17 00:00:00 2001 From: "dalecurtis@chromium.org" Date: Wed, 6 Feb 2013 21:01:55 +0000 Subject: Add --waveout-buffers switch for Windows users. Provides a fast means for debugging different WaveOut buffer counts on Windows machines. BUG=161307 TEST=flag results in the correct number of buffers. Review URL: https://chromiumcodereview.appspot.com/12224016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181049 0039d316-1c4b-4281-b951-d872f2087c98 --- media/audio/audio_util.cc | 8 ++++++++ media/base/media_switches.cc | 4 ++++ media/base/media_switches.h | 4 ++++ 3 files changed, 16 insertions(+) (limited to 'media') 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_ -- cgit v1.1