Merge "Remove hard-coded number of audio channels in AudioSource" into gingerbread
This commit is contained in:
@@ -440,7 +440,7 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() {
|
|||||||
new AudioSource(
|
new AudioSource(
|
||||||
mAudioSource,
|
mAudioSource,
|
||||||
mSampleRate,
|
mSampleRate,
|
||||||
AudioSystem::CHANNEL_IN_MONO);
|
mAudioChannels);
|
||||||
|
|
||||||
status_t err = audioSource->initCheck();
|
status_t err = audioSource->initCheck();
|
||||||
|
|
||||||
|
|||||||
@@ -33,15 +33,25 @@ namespace android {
|
|||||||
|
|
||||||
AudioSource::AudioSource(
|
AudioSource::AudioSource(
|
||||||
int inputSource, uint32_t sampleRate, uint32_t channels)
|
int inputSource, uint32_t sampleRate, uint32_t channels)
|
||||||
: mRecord(new AudioRecord(
|
: mStarted(false),
|
||||||
inputSource, sampleRate, AudioSystem::PCM_16_BIT, channels)),
|
|
||||||
mInitCheck(mRecord->initCheck()),
|
|
||||||
mStarted(false),
|
|
||||||
mCollectStats(false),
|
mCollectStats(false),
|
||||||
mTotalReadTimeUs(0),
|
mTotalReadTimeUs(0),
|
||||||
mTotalReadBytes(0),
|
mTotalReadBytes(0),
|
||||||
mTotalReads(0),
|
mTotalReads(0),
|
||||||
mGroup(NULL) {
|
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() {
|
AudioSource::~AudioSource() {
|
||||||
|
|||||||
Reference in New Issue
Block a user