summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-07 10:40:33 +0000
committerhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-07 10:40:33 +0000
commitfb709a7b383c5888fc8b3826cb426d9fe193df95 (patch)
tree86684be6c474f7e0b9f8b8f39c26f79a972bcf55
parentde62cfa221a8d4323eb52d8b92292ee921719a80 (diff)
downloadchromium_src-fb709a7b383c5888fc8b3826cb426d9fe193df95.zip
chromium_src-fb709a7b383c5888fc8b3826cb426d9fe193df95.tar.gz
chromium_src-fb709a7b383c5888fc8b3826cb426d9fe193df95.tar.bz2
Ensures that the user can select 8kHz input sample rate as default rate and still record audio. Will lead to reduced performance for wideband codecs but it will be possible to start and audio session.
BUG=126442 TEST=content_unittests --gtest-filter=WebRTC* on a device where the sample rate has been set to 8000Hz for audio input. Verify loopback audio. Review URL: http://codereview.chromium.org/10384028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135628 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/media/webrtc_audio_device_impl.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc
index 616e263..37d2f3d 100644
--- a/content/renderer/media/webrtc_audio_device_impl.cc
+++ b/content/renderer/media/webrtc_audio_device_impl.cc
@@ -25,7 +25,7 @@ static const double kMaxVolumeLevel = 255.0;
// for its current sample rate (set by the user) on Windows and Mac OS X.
// The listed rates below adds restrictions and WebRtcAudioDeviceImpl::Init()
// will fail if the user selects any rate outside these ranges.
-static int kValidInputRates[] = {96000, 48000, 44100, 32000, 16000};
+static int kValidInputRates[] = {96000, 48000, 44100, 32000, 16000, 8000};
static int kValidOutputRates[] = {96000, 48000, 44100};
#elif defined(OS_LINUX) || defined(OS_OPENBSD)
// media::GetAudioInput[Output]HardwareSampleRate() is hardcoded to return
@@ -40,6 +40,8 @@ namespace {
// audio frames. This enumerator covers all supported sizes for all platforms.
// Example: k480 <=> 480 audio frames <=> 10ms@48kHz.
// TODO(henrika): can be moved to the media namespace if more clients need it.
+// TODO(henrika): add support for k80 as well. Will be listed as unexpected for
+// now. Very rare case though and most likeley only on Mac OS X.
enum AudioFramesPerBuffer {
k160,
k320,
@@ -62,6 +64,8 @@ enum HistogramDirection {
// Helper method to convert integral values to their respective enum values
// above, or kUnexpectedAudioBufferSize if no match exists.
+// TODO(henrika): add support for k80 as well given that 8000Hz input now has
+// been added.
static AudioFramesPerBuffer AsAudioFramesPerBuffer(int frames_per_buffer) {
switch (frames_per_buffer) {
case 160: return k160;