| OLD | NEW |
| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // TODO(henrika): Figure out the right thing to do here. | 383 // TODO(henrika): Figure out the right thing to do here. |
| 384 if (hw_sample_rate && hw_buffer_size) { | 384 if (hw_sample_rate && hw_buffer_size) { |
| 385 sample_rate = hw_sample_rate; | 385 sample_rate = hw_sample_rate; |
| 386 buffer_size = hw_buffer_size; | 386 buffer_size = hw_buffer_size; |
| 387 } else { | 387 } else { |
| 388 use_input_params = true; | 388 use_input_params = true; |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 if (input_params.IsValid()) { | 392 if (input_params.IsValid()) { |
| 393 if (CoreAudioUtil::IsChannelLayoutSupported( | |
| 394 eRender, eConsole, input_params.channel_layout())) { | |
| 395 // Open up using the same channel layout as the source if it is | |
| 396 // supported by the hardware. | |
| 397 channel_layout = input_params.channel_layout(); | |
| 398 VLOG(1) << "Hardware channel layout is not used; using same " | |
| 399 << "layout as the source instead (" << channel_layout << ")"; | |
| 400 } | |
| 401 input_channels = input_params.input_channels(); | 393 input_channels = input_params.input_channels(); |
| 402 if (use_input_params) { | 394 if (use_input_params) { |
| 403 // If WASAPI isn't supported we'll fallback to WaveOut, which will take | 395 // If WASAPI isn't supported we'll fallback to WaveOut, which will take |
| 404 // care of resampling and bits per sample changes. By setting these | 396 // care of resampling and bits per sample changes. By setting these |
| 405 // equal to the input values, AudioOutputResampler will skip resampling | 397 // equal to the input values, AudioOutputResampler will skip resampling |
| 406 // and bit per sample differences (since the input parameters will match | 398 // and bit per sample differences (since the input parameters will match |
| 407 // the output parameters). | 399 // the output parameters). |
| 408 sample_rate = input_params.sample_rate(); | 400 sample_rate = input_params.sample_rate(); |
| 409 bits_per_sample = input_params.bits_per_sample(); | 401 bits_per_sample = input_params.bits_per_sample(); |
| 410 channel_layout = input_params.channel_layout(); | 402 channel_layout = input_params.channel_layout(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 438 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 430 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
| 439 xp_device_id); | 431 xp_device_id); |
| 440 } | 432 } |
| 441 | 433 |
| 442 /// static | 434 /// static |
| 443 AudioManager* CreateAudioManager() { | 435 AudioManager* CreateAudioManager() { |
| 444 return new AudioManagerWin(); | 436 return new AudioManagerWin(); |
| 445 } | 437 } |
| 446 | 438 |
| 447 } // namespace media | 439 } // namespace media |
| OLD | NEW |