| 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 } |
| 393 input_channels = input_params.input_channels(); | 401 input_channels = input_params.input_channels(); |
| 394 if (use_input_params) { | 402 if (use_input_params) { |
| 395 // If WASAPI isn't supported we'll fallback to WaveOut, which will take | 403 // If WASAPI isn't supported we'll fallback to WaveOut, which will take |
| 396 // care of resampling and bits per sample changes. By setting these | 404 // care of resampling and bits per sample changes. By setting these |
| 397 // equal to the input values, AudioOutputResampler will skip resampling | 405 // equal to the input values, AudioOutputResampler will skip resampling |
| 398 // and bit per sample differences (since the input parameters will match | 406 // and bit per sample differences (since the input parameters will match |
| 399 // the output parameters). | 407 // the output parameters). |
| 400 sample_rate = input_params.sample_rate(); | 408 sample_rate = input_params.sample_rate(); |
| 401 bits_per_sample = input_params.bits_per_sample(); | 409 bits_per_sample = input_params.bits_per_sample(); |
| 402 channel_layout = input_params.channel_layout(); | 410 channel_layout = input_params.channel_layout(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 430 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 438 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
| 431 xp_device_id); | 439 xp_device_id); |
| 432 } | 440 } |
| 433 | 441 |
| 434 /// static | 442 /// static |
| 435 AudioManager* CreateAudioManager() { | 443 AudioManager* CreateAudioManager() { |
| 436 return new AudioManagerWin(); | 444 return new AudioManagerWin(); |
| 437 } | 445 } |
| 438 | 446 |
| 439 } // namespace media | 447 } // namespace media |
| OLD | NEW |