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 16 matching lines...) Expand all Loading... |
27 // Supported hardware sample rates for output sides. | 27 // Supported hardware sample rates for output sides. |
28 #if defined(OS_WIN) || defined(OS_MACOSX) | 28 #if defined(OS_WIN) || defined(OS_MACOSX) |
29 // AudioHardwareConfig::GetOutputSampleRate() asks the audio layer for its | 29 // AudioHardwareConfig::GetOutputSampleRate() asks the audio layer for its |
30 // current sample rate (set by the user) on Windows and Mac OS X. The listed | 30 // current sample rate (set by the user) on Windows and Mac OS X. The listed |
31 // rates below adds restrictions and Initialize() will fail if the user selects | 31 // rates below adds restrictions and Initialize() will fail if the user selects |
32 // any rate outside these ranges. | 32 // any rate outside these ranges. |
33 int kValidOutputRates[] = {96000, 48000, 44100}; | 33 int kValidOutputRates[] = {96000, 48000, 44100}; |
34 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 34 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
35 int kValidOutputRates[] = {48000, 44100}; | 35 int kValidOutputRates[] = {48000, 44100}; |
36 #elif defined(OS_ANDROID) | 36 #elif defined(OS_ANDROID) |
37 // On Android, the most popular sampling rate is 16000. | 37 // TODO(leozwang): We want to use native sampling rate on Android to achieve |
| 38 // low latency, currently 16000 is used to work around audio problem on some |
| 39 // Android devices. |
38 int kValidOutputRates[] = {48000, 44100, 16000}; | 40 int kValidOutputRates[] = {48000, 44100, 16000}; |
39 #else | 41 #else |
40 int kValidOutputRates[] = {44100}; | 42 int kValidOutputRates[] = {44100}; |
41 #endif | 43 #endif |
42 | 44 |
43 // TODO(xians): Merge the following code to WebRtcAudioCapturer, or remove. | 45 // TODO(xians): Merge the following code to WebRtcAudioCapturer, or remove. |
44 enum AudioFramesPerBuffer { | 46 enum AudioFramesPerBuffer { |
45 k160, | 47 k160, |
46 k320, | 48 k320, |
47 k440, // WebRTC works internally with 440 audio frames at 44.1kHz. | 49 k440, // WebRTC works internally with 440 audio frames at 44.1kHz. |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 params_.bits_per_sample() / 8); | 302 params_.bits_per_sample() / 8); |
301 return audio_bus->frames(); | 303 return audio_bus->frames(); |
302 } | 304 } |
303 | 305 |
304 void WebRtcAudioRenderer::OnRenderError() { | 306 void WebRtcAudioRenderer::OnRenderError() { |
305 NOTIMPLEMENTED(); | 307 NOTIMPLEMENTED(); |
306 LOG(ERROR) << "OnRenderError()"; | 308 LOG(ERROR) << "OnRenderError()"; |
307 } | 309 } |
308 | 310 |
309 } // namespace content | 311 } // namespace content |
OLD | NEW |