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

Side by Side Diff: media/audio/win/audio_low_latency_input_win.cc

Issue 518433002: Revert of Revert of Remove the last piece of deprecated synchronous IO code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/win/audio_low_latency_input_win.h" 5 #include "media/audio/win/audio_low_latency_input_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "media/audio/win/audio_manager_win.h" 10 #include "media/audio/win/audio_manager_win.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 int effects = AudioParameters::NO_EFFECTS; 275 int effects = AudioParameters::NO_EFFECTS;
276 if (SUCCEEDED(GetMixFormat(device_id, &audio_engine_mix_format, &effects))) { 276 if (SUCCEEDED(GetMixFormat(device_id, &audio_engine_mix_format, &effects))) {
277 sample_rate = static_cast<int>(audio_engine_mix_format->nSamplesPerSec); 277 sample_rate = static_cast<int>(audio_engine_mix_format->nSamplesPerSec);
278 channel_layout = audio_engine_mix_format->nChannels == 1 ? 278 channel_layout = audio_engine_mix_format->nChannels == 1 ?
279 CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; 279 CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO;
280 } 280 }
281 281
282 // Use 10ms frame size as default. 282 // Use 10ms frame size as default.
283 int frames_per_buffer = sample_rate / 100; 283 int frames_per_buffer = sample_rate / 100;
284 return AudioParameters( 284 return AudioParameters(
285 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, 0, sample_rate, 285 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
286 16, frames_per_buffer, effects); 286 16, frames_per_buffer, effects);
287 } 287 }
288 288
289 // static 289 // static
290 HRESULT WASAPIAudioInputStream::GetMixFormat(const std::string& device_id, 290 HRESULT WASAPIAudioInputStream::GetMixFormat(const std::string& device_id,
291 WAVEFORMATEX** device_format, 291 WAVEFORMATEX** device_format,
292 int* effects) { 292 int* effects) {
293 DCHECK(effects); 293 DCHECK(effects);
294 294
295 // It is assumed that this static method is called from a COM thread, i.e., 295 // It is assumed that this static method is called from a COM thread, i.e.,
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 return hr; 741 return hr;
742 742
743 // Obtain a reference to the ISimpleAudioVolume interface which enables 743 // Obtain a reference to the ISimpleAudioVolume interface which enables
744 // us to control the master volume level of an audio session. 744 // us to control the master volume level of an audio session.
745 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), 745 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume),
746 simple_audio_volume_.ReceiveVoid()); 746 simple_audio_volume_.ReceiveVoid());
747 return hr; 747 return hr;
748 } 748 }
749 749
750 } // namespace media 750 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/pulse/audio_manager_pulse.cc ('k') | media/audio/win/audio_low_latency_input_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698