diff options
author | James Dong <jdong@google.com> | 2010-06-14 17:45:35 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-06-14 17:45:35 -0700 |
commit | d77d2a980c6fbdc00b7d62a34d9b799dcf8c9514 (patch) | |
tree | 0cfb3af77c4ab0d914698b931049694649b12e24 /media/libstagefright/AudioSource.cpp | |
parent | 96e59eb8f34e999deb9eb4974cbfc07c71df3cab (diff) | |
download | frameworks_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/libstagefright/AudioSource.cpp')
-rw-r--r-- | media/libstagefright/AudioSource.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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() { |