Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: media/audio/audio_util.cc

Issue 10575017: Adding experimental exclusive-mode streaming to WASAPIAudioOutputStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding WebAudio experimental parameters Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_util.cc
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc
index 4035d28a589fa4737cee6b1b5561fcca3a02f443..c5df9071386e5d1258f33d80968f491f706fb87e 100644
--- a/media/audio/audio_util.cc
+++ b/media/audio/audio_util.cc
@@ -17,6 +17,9 @@
#include "base/atomicops.h"
#include "base/basictypes.h"
+#if defined(OS_WIN)
+#include "base/command_line.h"
+#endif
#include "base/logging.h"
#include "base/shared_memory.h"
#include "base/time.h"
@@ -34,6 +37,7 @@
#if defined(OS_WIN)
#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"
#endif
using base::subtle::Atomic32;
@@ -351,10 +355,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)) {
+ // 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);
+ } else {
+ return 44100;
+ }
#elif defined(OS_ANDROID)
return 16000;
#else
@@ -397,6 +406,12 @@ size_t GetAudioHardwareBufferSize() {
// and assume 48kHz as default sample rate.
return 2048;
}
+
+ 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 =
« no previous file with comments | « no previous file | media/audio/win/audio_low_latency_output_win.h » ('j') | media/audio/win/audio_low_latency_output_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698