summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-06-14 17:45:35 -0700
committerJames Dong <jdong@google.com>2010-06-14 17:45:35 -0700
commitd77d2a980c6fbdc00b7d62a34d9b799dcf8c9514 (patch)
tree0cfb3af77c4ab0d914698b931049694649b12e24 /media
parent96e59eb8f34e999deb9eb4974cbfc07c71df3cab (diff)
downloadframeworks_base-d77d2a980c6fbdc00b7d62a34d9b799dcf8c9514.zip
frameworks_base-d77d2a980c6fbdc00b7d62a34d9b799dcf8c9514.tar.gz
frameworks_base-d77d2a980c6fbdc00b7d62a34d9b799dcf8c9514.tar.bz2
Remove hard-coded number of audio channels in AudioSource
Change-Id: I5f362252c25e2251bbfa9818b711ee23b4975248
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp2
-rw-r--r--media/libstagefright/AudioSource.cpp18
2 files changed, 15 insertions, 5 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index a7ccce4..9b30d1f 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -440,7 +440,7 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() {
new AudioSource(
mAudioSource,
mSampleRate,
- AudioSystem::CHANNEL_IN_MONO);
+ mAudioChannels);
status_t err = audioSource->initCheck();
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 9717aa6..d6020a6 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -33,15 +33,25 @@ namespace android {
AudioSource::AudioSource(
int inputSource, uint32_t sampleRate, uint32_t channels)
- : mRecord(new AudioRecord(
- inputSource, sampleRate, AudioSystem::PCM_16_BIT, channels)),
- mInitCheck(mRecord->initCheck()),
- mStarted(false),
+ : mStarted(false),
mCollectStats(false),
mTotalReadTimeUs(0),
mTotalReadBytes(0),
mTotalReads(0),
mGroup(NULL) {
+
+ LOGV("sampleRate: %d, channels: %d", sampleRate, channels);
+ uint32_t flags = AudioRecord::RECORD_AGC_ENABLE |
+ AudioRecord::RECORD_NS_ENABLE |
+ AudioRecord::RECORD_IIR_ENABLE;
+
+ mRecord = new AudioRecord(
+ inputSource, sampleRate, AudioSystem::PCM_16_BIT,
+ channels > 1? AudioSystem::CHANNEL_IN_STEREO: AudioSystem::CHANNEL_IN_MONO,
+ 4 * kMaxBufferSize / sizeof(int16_t), /* Enable ping-pong buffers */
+ flags);
+
+ mInitCheck = mRecord->initCheck();
}
AudioSource::~AudioSource() {