am d8402d78: am cd677a30: Merge "Remove hard-coded number of audio channels in AudioSource" into gingerbread

Merge commit 'd8402d7861ed81e90dd0a03b9a630e66551cc783'

* commit 'd8402d7861ed81e90dd0a03b9a630e66551cc783':
  Remove hard-coded number of audio channels in AudioSource
This commit is contained in:
James Dong
2010-06-17 11:28:28 -07:00
committed by Android Git Automerger
2 changed files with 15 additions and 5 deletions

View File

@@ -440,7 +440,7 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() {
new AudioSource(
mAudioSource,
mSampleRate,
AudioSystem::CHANNEL_IN_MONO);
mAudioChannels);
status_t err = audioSource->initCheck();

View File

@@ -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() {