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

Unified Diff: media/audio/win/audio_manager_win.cc

Issue 10913267: Bypass audio resampler on XP / non-WASAPI wave out path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 3 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
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_manager_win.cc
diff --git a/media/audio/win/audio_manager_win.cc b/media/audio/win/audio_manager_win.cc
index 82a2ddf9b031d80fbd38026bf0bfab33b1a960e9..46a387c394eafa389fc262dfe3c1e2386edfaab6 100644
--- a/media/audio/win/audio_manager_win.cc
+++ b/media/audio/win/audio_manager_win.cc
@@ -317,4 +317,24 @@ AudioManager* CreateAudioManager() {
return new AudioManagerWin();
}
+AudioParameters AudioManagerWin::GetPreferredLowLatencyOutputStreamParameters(
+ const AudioParameters& input_params) {
+ // If WASAPI isn't supported we'll fallback to WaveOut, which will take care
+ // of resampling and bits per sample changes. By setting these equal to the
+ // input values, AudioOutputResampler will skip resampling and bit per sample
+ // differences (since the input parameters will match the output parameters).
+ int sample_rate = input_params.sample_rate();
+ int bits_per_sample = input_params.bits_per_sample();
+ if (IsWASAPISupported()) {
+ sample_rate = GetAudioHardwareSampleRate();
+ bits_per_sample = 16;
+ }
+
+ // TODO(dalecurtis): This should include bits per channel and channel layout
+ // eventually.
+ return AudioParameters(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, input_params.channel_layout(),
+ sample_rate, bits_per_sample, GetAudioHardwareBufferSize());
+}
+
} // namespace media
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698