summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorannacc@chromium.org <annacc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 22:18:32 +0000
committerannacc@chromium.org <annacc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 22:18:32 +0000
commitb630cb97c620593f9c987fdad0b3271ddbf39a3e (patch)
tree21295811329d31b302e29be7e16198fdfd5bc463 /content/browser
parent99d22e8b1c2c0b6f6457147ab90ce2df98ef02d3 (diff)
downloadchromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.zip
chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.tar.gz
chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.tar.bz2
Description:
This patch gets the channel layout for surround sound channel order from ffmpeg and stores it so that chromium will be able to re-order the channels for various sound cards and OSes later. - AudioParameters gets a new field (channel_layout). - channel_layout.h stores an enum that we will use in chromium for channel values. - ffmpeg_common.h gets a new method for mapping the channel layout received from ffmpeg to an internal chromium enum value. BUG=None (though storing the channel order should help us solve some other bugs soon) TEST=media_unittests Review URL: http://codereview.chromium.org/6930039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/speech/speech_recognizer.cc4
-rw-r--r--content/browser/speech/speech_recognizer.h2
-rw-r--r--content/browser/speech/speech_recognizer_unittest.cc2
3 files changed, 4 insertions, 4 deletions
diff --git a/content/browser/speech/speech_recognizer.cc b/content/browser/speech/speech_recognizer.cc
index 7a4ebd1..9408f46 100644
--- a/content/browser/speech/speech_recognizer.cc
+++ b/content/browser/speech/speech_recognizer.cc
@@ -49,7 +49,7 @@ namespace speech_input {
const int SpeechRecognizer::kAudioSampleRate = 16000;
const int SpeechRecognizer::kAudioPacketIntervalMs = 100;
-const int SpeechRecognizer::kNumAudioChannels = 1;
+const ChannelLayout SpeechRecognizer::kChannelLayout = CHANNEL_LAYOUT_MONO;
const int SpeechRecognizer::kNumBitsPerAudioSample = 16;
const int SpeechRecognizer::kNoSpeechTimeoutSec = 8;
const int SpeechRecognizer::kEndpointerEstimationTimeMs = 300;
@@ -102,7 +102,7 @@ bool SpeechRecognizer::StartRecording() {
encoder_.reset(AudioEncoder::Create(codec_, kAudioSampleRate,
kNumBitsPerAudioSample));
int samples_per_packet = (kAudioSampleRate * kAudioPacketIntervalMs) / 1000;
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kNumAudioChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kAudioSampleRate, kNumBitsPerAudioSample,
samples_per_packet);
audio_controller_ = AudioInputController::Create(this, params);
diff --git a/content/browser/speech/speech_recognizer.h b/content/browser/speech/speech_recognizer.h
index a87831e..f60a9de 100644
--- a/content/browser/speech/speech_recognizer.h
+++ b/content/browser/speech/speech_recognizer.h
@@ -113,7 +113,7 @@ class SpeechRecognizer
static const int kAudioSampleRate;
static const int kAudioPacketIntervalMs; // Duration of each audio packet.
- static const int kNumAudioChannels;
+ static const ChannelLayout kChannelLayout;
static const int kNumBitsPerAudioSample;
static const int kNoSpeechTimeoutSec;
static const int kEndpointerEstimationTimeMs;
diff --git a/content/browser/speech/speech_recognizer_unittest.cc b/content/browser/speech/speech_recognizer_unittest.cc
index 5e5ce8e..fbb04db 100644
--- a/content/browser/speech/speech_recognizer_unittest.cc
+++ b/content/browser/speech/speech_recognizer_unittest.cc
@@ -36,7 +36,7 @@ class SpeechRecognizerTest : public SpeechRecognizerDelegate,
int audio_packet_length_bytes =
(SpeechRecognizer::kAudioSampleRate *
SpeechRecognizer::kAudioPacketIntervalMs *
- SpeechRecognizer::kNumAudioChannels *
+ ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) *
SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000);
audio_packet_.resize(audio_packet_length_bytes);
}