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

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

Issue 9655018: Make AudioParameters a class instead of a struct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright years Created 8 years, 9 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_low_latency_output_win.h ('k') | media/audio/win/audio_manager_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_low_latency_output_win.cc
diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc
index 994cbb696ec626cc18a5ce0564120ec822576c78..28dbac889e9afda44753e7d122c2814e65de2940 100644
--- a/media/audio/win/audio_low_latency_output_win.cc
+++ b/media/audio/win/audio_low_latency_output_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -39,10 +39,10 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(AudioManagerWin* manager,
DCHECK(avrt_init) << "Failed to load the avrt.dll";
// Set up the desired render format specified by the client.
- format_.nSamplesPerSec = params.sample_rate;
+ format_.nSamplesPerSec = params.sample_rate();
format_.wFormatTag = WAVE_FORMAT_PCM;
- format_.wBitsPerSample = params.bits_per_sample;
- format_.nChannels = params.channels;
+ format_.wBitsPerSample = params.bits_per_sample();
+ format_.nChannels = params.channels();
format_.nBlockAlign = (format_.wBitsPerSample / 8) * format_.nChannels;
format_.nAvgBytesPerSec = format_.nSamplesPerSec * format_.nBlockAlign;
format_.cbSize = 0;
@@ -52,9 +52,9 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(AudioManagerWin* manager,
// Store size (in different units) of audio packets which we expect to
// get from the audio endpoint device in each render event.
- packet_size_frames_ = params.GetPacketSize() / format_.nBlockAlign;
- packet_size_bytes_ = params.GetPacketSize();
- packet_size_ms_ = (1000.0 * packet_size_frames_) / params.sample_rate;
+ packet_size_frames_ = params.GetBytesPerBuffer() / format_.nBlockAlign;
+ packet_size_bytes_ = params.GetBytesPerBuffer();
+ packet_size_ms_ = (1000.0 * packet_size_frames_) / params.sample_rate();
DVLOG(1) << "Number of bytes per audio frame : " << frame_size_;
DVLOG(1) << "Number of audio frames per packet: " << packet_size_frames_;
DVLOG(1) << "Number of milliseconds per packet: " << packet_size_ms_;
@@ -253,7 +253,7 @@ void WASAPIAudioOutputStream::GetVolume(double* volume) {
}
// static
-double WASAPIAudioOutputStream::HardwareSampleRate(ERole device_role) {
+int WASAPIAudioOutputStream::HardwareSampleRate(ERole device_role) {
// It is assumed that this static method is called from a COM thread, i.e.,
// CoInitializeEx() is not called here again to avoid STA/MTA conflicts.
ScopedComPtr<IMMDeviceEnumerator> enumerator;
@@ -296,7 +296,7 @@ double WASAPIAudioOutputStream::HardwareSampleRate(ERole device_role) {
return 0.0;
}
- return static_cast<double>(audio_engine_mix_format->nSamplesPerSec);
+ return static_cast<int>(audio_engine_mix_format->nSamplesPerSec);
}
void WASAPIAudioOutputStream::Run() {
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.h ('k') | media/audio/win/audio_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698