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

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

Issue 12918026: Adds support for CoreAudioUtil::IsChannelLayoutSupported() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dalecurtis@ Created 7 years, 8 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/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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 sample_rate = WASAPIAudioOutputStream::HardwareSampleRate(); 380 sample_rate = WASAPIAudioOutputStream::HardwareSampleRate();
381 381
382 AudioParameters params; 382 AudioParameters params;
383 HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters(eRender, eConsole, 383 HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters(eRender, eConsole,
384 &params); 384 &params);
385 buffer_size = FAILED(hr) ? kFallbackBufferSize : params.frames_per_buffer(); 385 buffer_size = FAILED(hr) ? kFallbackBufferSize : params.frames_per_buffer();
386 channel_layout = WASAPIAudioOutputStream::HardwareChannelLayout(); 386 channel_layout = WASAPIAudioOutputStream::HardwareChannelLayout();
387 } 387 }
388 388
389 if (input_params.IsValid()) { 389 if (input_params.IsValid()) {
390 if (CoreAudioUtil::IsChannelLayoutSupported(
391 eRender, eConsole, input_params.channel_layout())) {
392 // Open up using the same channel layout as the source if it is
393 // supported by the hardware.
394 channel_layout = input_params.channel_layout();
395 VLOG(1) << "Hardware channel layout is not used; using same "
396 << "layout as the source instead (" << channel_layout << ")";
397 }
390 input_channels = input_params.input_channels(); 398 input_channels = input_params.input_channels();
391 if (!CoreAudioUtil::IsSupported()) { 399 if (!CoreAudioUtil::IsSupported()) {
392 // If WASAPI isn't supported we'll fallback to WaveOut, which will take 400 // If WASAPI isn't supported we'll fallback to WaveOut, which will take
393 // care of resampling and bits per sample changes. By setting these 401 // care of resampling and bits per sample changes. By setting these
394 // equal to the input values, AudioOutputResampler will skip resampling 402 // equal to the input values, AudioOutputResampler will skip resampling
395 // and bit per sample differences (since the input parameters will match 403 // and bit per sample differences (since the input parameters will match
396 // the output parameters). 404 // the output parameters).
397 sample_rate = input_params.sample_rate(); 405 sample_rate = input_params.sample_rate();
398 bits_per_sample = input_params.bits_per_sample(); 406 bits_per_sample = input_params.bits_per_sample();
399 channel_layout = input_params.channel_layout(); 407 channel_layout = input_params.channel_layout();
(...skipping 26 matching lines...) Expand all
426 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, 434 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers,
427 xp_device_id); 435 xp_device_id);
428 } 436 }
429 437
430 /// static 438 /// static
431 AudioManager* CreateAudioManager() { 439 AudioManager* CreateAudioManager() {
432 return new AudioManagerWin(); 440 return new AudioManagerWin();
433 } 441 }
434 442
435 } // namespace media 443 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/audio/win/core_audio_util_win.h » ('j') | media/audio/win/core_audio_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698