Index: content/renderer/media/webrtc_audio_device_impl.cc |
diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc |
index 300439d6012095d550e52095341d8ac38216919f..d9f42b119ef28715536d3e2f7854e1013e89a748 100644 |
--- a/content/renderer/media/webrtc_audio_device_impl.cc |
+++ b/content/renderer/media/webrtc_audio_device_impl.cc |
@@ -300,7 +300,11 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
static_cast<int>(audio_hardware::GetInputSampleRate()); |
DVLOG(1) << "Audio input hardware sample rate: " << input_sample_rate; |
- int input_channels = 0; |
+ // Ask the browser for the default number of audio input channels. |
+ // This request is based on a synchronous IPC message. |
+ int input_channels = audio_hardware::GetInputChannels(); |
+ DVLOG(1) << "Audio input hardware channels: " << input_channels; |
+ |
int output_channels = 0; |
size_t input_buffer_size = 0; |
@@ -308,21 +312,17 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
// Windows |
#if defined(OS_WIN) |
- if (input_sample_rate != 48000 && input_sample_rate != 44100) { |
- DLOG(ERROR) << "Only 48 and 44.1kHz input rates are supported on Windows."; |
+ if (input_sample_rate != 48000 && input_sample_rate != 44100 && |
+ input_sample_rate != 16000) { |
tommi (sloooow) - chröme
2012/01/17 12:01:08
also support 32kHz as discussed
henrika (OOO until Aug 14)
2012/01/17 12:54:59
Done.
|
+ DLOG(ERROR) << "Only 48, 44.1 and 16kHz input rates are supported."; |
return -1; |
} |
if (output_sample_rate != 48000 && output_sample_rate != 44100) { |
- DLOG(ERROR) << "Only 48 and 44.1kHz output rates are supported on Windows."; |
+ DLOG(ERROR) << "Only 48 and 44.1kHz output rates are supported."; |
return -1; |
} |
- // Use stereo recording on Windows since low-latency Core Audio (WASAPI) |
- // does not support mono. |
- input_channels = 2; |
- |
- // Use stereo rendering on Windows to make input and output sides |
- // symmetric. WASAPI supports both stereo and mono. |
+ // Always use stereo rendering on Windows. |
output_channels = 2; |
// Capture side: AUDIO_PCM_LOW_LATENCY is based on the Core Audio (WASAPI) |
@@ -331,12 +331,12 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
// size of 10ms works well for both these implementations. |
// Use different buffer sizes depending on the current hardware sample rate. |
- if (input_sample_rate == 48000) { |
- input_buffer_size = 480; |
- } else { |
+ if (input_sample_rate == 44100) { |
// We do run at 44.1kHz at the actual audio layer, but ask for frames |
// at 44.0kHz to ensure that we can feed them to the webrtc::VoiceEngine. |
input_buffer_size = 440; |
+ } else { |
+ input_buffer_size = (input_sample_rate / 100); |
} |
// Render side: AUDIO_PCM_LOW_LATENCY is based on the Core Audio (WASAPI) |
@@ -357,7 +357,7 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
// Windows XP and lower can't cope with 10 ms output buffer size. |
// It must be extended to 30 ms (60 ms will be used internally by WaveOut). |
- if (base::win::GetVersion() <= base::win::VERSION_XP) { |
+ if (!media::IsWASAPISupported()) { |
output_buffer_size = 3 * output_buffer_size; |
DLOG(WARNING) << "Extending the output buffer size by a factor of three " |
<< "since Windows XP has been detected."; |