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

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

Issue 23466008: Wire up the output device id and provide an implementation on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update comments Created 7 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
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/audio_io.h" 5 #include "media/audio/audio_io.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <objbase.h> // This has to be before initguid.h 8 #include <objbase.h> // This has to be before initguid.h
9 #include <initguid.h> 9 #include <initguid.h>
10 #include <mmsystem.h> 10 #include <mmsystem.h>
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 // Factory for the implementations of AudioOutputStream for 304 // Factory for the implementations of AudioOutputStream for
305 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most 305 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most
306 // windows user's needs. 306 // windows user's needs.
307 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. 307 // - PCMWaveOutAudioOutputStream: Based on the waveOut API.
308 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. 308 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API.
309 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( 309 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream(
310 const AudioParameters& params, 310 const AudioParameters& params,
311 const std::string& device_id, 311 const std::string& device_id,
312 const std::string& input_device_id) { 312 const std::string& input_device_id) {
313 DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
314 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); 313 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
315 if (params.channels() > kWinMaxChannels) 314 if (params.channels() > kWinMaxChannels)
316 return NULL; 315 return NULL;
317 316
318 if (!CoreAudioUtil::IsSupported()) { 317 if (!CoreAudioUtil::IsSupported()) {
319 // Fall back to Windows Wave implementation on Windows XP or lower. 318 // Fall back to Windows Wave implementation on Windows XP or lower.
319 DLOG_IF(ERROR, !device_id.empty())
320 << "Opening by device id not supported by PCMWaveOutAudioOutputStream";
320 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; 321 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista.";
321 return new PCMWaveOutAudioOutputStream( 322 return new PCMWaveOutAudioOutputStream(
322 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER); 323 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER);
323 } 324 }
324 325
325 // TODO(rtoy): support more than stereo input. 326 // TODO(rtoy): support more than stereo input.
326 if (params.input_channels() > 0) { 327 if (params.input_channels() > 0) {
327 DVLOG(1) << "WASAPIUnifiedStream is created."; 328 DVLOG(1) << "WASAPIUnifiedStream is created.";
329 DLOG_IF(ERROR, !device_id.empty())
330 << "Opening by device id not supported by WASAPIUnifiedStream";
328 return new WASAPIUnifiedStream(this, params, input_device_id); 331 return new WASAPIUnifiedStream(this, params, input_device_id);
329 } 332 }
330 333
331 return new WASAPIAudioOutputStream(this, params, eConsole); 334 return new WASAPIAudioOutputStream(this, device_id, params, eConsole);
332 } 335 }
333 336
334 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR 337 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR
335 // mode. 338 // mode.
336 AudioInputStream* AudioManagerWin::MakeLinearInputStream( 339 AudioInputStream* AudioManagerWin::MakeLinearInputStream(
337 const AudioParameters& params, const std::string& device_id) { 340 const AudioParameters& params, const std::string& device_id) {
338 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 341 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
339 return CreatePCMWaveInAudioInputStream(params, device_id); 342 return CreatePCMWaveInAudioInputStream(params, device_id);
340 } 343 }
341 344
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, 471 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers,
469 xp_device_id); 472 xp_device_id);
470 } 473 }
471 474
472 /// static 475 /// static
473 AudioManager* CreateAudioManager() { 476 AudioManager* CreateAudioManager() {
474 return new AudioManagerWin(); 477 return new AudioManagerWin();
475 } 478 }
476 479
477 } // namespace media 480 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698