diff options
author | James Dong <jdong@google.com> | 2010-09-01 15:56:25 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-01 15:56:25 -0700 |
commit | 4cd45f8664678c37bf0e13f76b1718bfbd7a1372 (patch) | |
tree | 4f88f110901ba4c697589e49becee8e188a95685 /media | |
parent | 002b34c3f56932fa472ee4a9fd47a8b021a27b1a (diff) | |
parent | e91b46246305ba233067e06bce8d8a82e6c5b101 (diff) | |
download | frameworks_av-4cd45f8664678c37bf0e13f76b1718bfbd7a1372.zip frameworks_av-4cd45f8664678c37bf0e13f76b1718bfbd7a1372.tar.gz frameworks_av-4cd45f8664678c37bf0e13f76b1718bfbd7a1372.tar.bz2 |
am d3c1bae4: Merge "Make sure that if initialization fails, AudioSource still behaves well." into gingerbread
Merge commit 'd3c1bae4eb78404bd1e17b7acf67087a18c83ef3' into gingerbread-plus-aosp
* commit 'd3c1bae4eb78404bd1e17b7acf67087a18c83ef3':
Make sure that if initialization fails, AudioSource still behaves well.
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AudioSource.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index 4c729e4..bcae913 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -72,6 +72,10 @@ status_t AudioSource::start(MetaData *params) { return UNKNOWN_ERROR; } + if (mInitCheck != OK) { + return NO_INIT; + } + char value[PROPERTY_VALUE_MAX]; if (property_get("media.stagefright.record-stats", value, NULL) && (!strcmp(value, "1") || !strcasecmp(value, "true"))) { @@ -102,6 +106,10 @@ status_t AudioSource::stop() { return UNKNOWN_ERROR; } + if (mInitCheck != OK) { + return NO_INIT; + } + mRecord->stop(); delete mGroup; @@ -118,6 +126,10 @@ status_t AudioSource::stop() { } sp<MetaData> AudioSource::getFormat() { + if (mInitCheck != OK) { + return 0; + } + sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeySampleRate, mRecord->getSampleRate()); @@ -193,6 +205,11 @@ void AudioSource::rampVolume( status_t AudioSource::read( MediaBuffer **out, const ReadOptions *options) { + + if (mInitCheck != OK) { + return NO_INIT; + } + *out = NULL; MediaBuffer *buffer; @@ -294,10 +311,6 @@ status_t AudioSource::read( buffer->meta_data()->setInt64(kKeyTime, mPrevSampleTimeUs); CHECK(timestampUs > mPrevSampleTimeUs); - if (mTotalLostFrames == 0) { - CHECK_EQ(mPrevSampleTimeUs, - mStartTimeUs + (1000000LL * numFramesRecorded) / sampleRate); - } mPrevSampleTimeUs = timestampUs; LOGV("initial delay: %lld, sample rate: %d, timestamp: %lld", mStartTimeUs, sampleRate, timestampUs); |