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 "content/renderer/media/webrtc_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_audio_renderer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "content/renderer/media/audio_device_factory.h" | 10 #include "content/renderer/media/audio_device_factory.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 153 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
154 buffer_size = 3 * buffer_size; | 154 buffer_size = 3 * buffer_size; |
155 DLOG(WARNING) << "Extending the output buffer size by a factor of three " | 155 DLOG(WARNING) << "Extending the output buffer size by a factor of three " |
156 << "since Windows XP has been detected."; | 156 << "since Windows XP has been detected."; |
157 } | 157 } |
158 #elif defined(OS_MACOSX) | 158 #elif defined(OS_MACOSX) |
159 channel_layout = media::CHANNEL_LAYOUT_MONO; | 159 channel_layout = media::CHANNEL_LAYOUT_MONO; |
160 | 160 |
161 // Render side: AUDIO_PCM_LOW_LATENCY on Mac OS X is based on a callback- | 161 // Render side: AUDIO_PCM_LOW_LATENCY on Mac OS X is based on a callback- |
162 // driven Core Audio implementation. Tests have shown that 10ms is a suitable | 162 // driven Core Audio implementation. Tests have shown that 10ms is a suitable |
163 // frame size to use, both for 48kHz and 44.1kHz. | 163 // frame size to use for 96kHz, 48kHz and 44.1kHz. |
164 | 164 |
165 // Use different buffer sizes depending on the current hardware sample rate. | 165 // Use different buffer sizes depending on the current hardware sample rate. |
166 if (sample_rate == 48000) { | 166 if (sample_rate == 96000 || sample_rate == 48000) { |
167 buffer_size = 480; | 167 buffer_size = (sample_rate / 100); |
168 } else { | 168 } else { |
169 // We do run at 44.1kHz at the actual audio layer, but ask for frames | 169 // We do run at 44.1kHz at the actual audio layer, but ask for frames |
170 // at 44.0kHz to ensure that we can feed them to the webrtc::VoiceEngine. | 170 // at 44.0kHz to ensure that we can feed them to the webrtc::VoiceEngine. |
171 buffer_size = 440; | 171 buffer_size = 440; |
172 } | 172 } |
173 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 173 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
174 channel_layout = media::CHANNEL_LAYOUT_MONO; | 174 channel_layout = media::CHANNEL_LAYOUT_MONO; |
175 | 175 |
176 // Based on tests using the current ALSA implementation in Chrome, we have | 176 // Based on tests using the current ALSA implementation in Chrome, we have |
177 // found that 10ms buffer size on the output side works fine. | 177 // found that 10ms buffer size on the output side works fine. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 params_.bits_per_sample() / 8); | 282 params_.bits_per_sample() / 8); |
283 return audio_bus->frames(); | 283 return audio_bus->frames(); |
284 } | 284 } |
285 | 285 |
286 void WebRtcAudioRenderer::OnRenderError() { | 286 void WebRtcAudioRenderer::OnRenderError() { |
287 NOTIMPLEMENTED(); | 287 NOTIMPLEMENTED(); |
288 LOG(ERROR) << "OnRenderError()"; | 288 LOG(ERROR) << "OnRenderError()"; |
289 } | 289 } |
290 | 290 |
291 } // namespace content | 291 } // namespace content |
OLD | NEW |