diff options
author | James Dong <jdong@google.com> | 2010-09-03 12:01:55 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-09-03 12:01:55 -0700 |
commit | caa68a57f0b358b8fbe17447ffa453b9120a8610 (patch) | |
tree | 845d7aadda6f7912d6b8a056933cea59164c3041 /media/libstagefright/codecs/aacenc/AACEncoder.cpp | |
parent | b4d5320bda29cd9694461c9b61d0211f801ff0af (diff) | |
download | frameworks_av-caa68a57f0b358b8fbe17447ffa453b9120a8610.zip frameworks_av-caa68a57f0b358b8fbe17447ffa453b9120a8610.tar.gz frameworks_av-caa68a57f0b358b8fbe17447ffa453b9120a8610.tar.bz2 |
Not all audio source has the drift time information
Change-Id: I74e502376348ca4a6ffaa7492bed35c1355e7e62
Diffstat (limited to 'media/libstagefright/codecs/aacenc/AACEncoder.cpp')
-rw-r--r-- | media/libstagefright/codecs/aacenc/AACEncoder.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/media/libstagefright/codecs/aacenc/AACEncoder.cpp b/media/libstagefright/codecs/aacenc/AACEncoder.cpp index c05e3e5..e391c72 100644 --- a/media/libstagefright/codecs/aacenc/AACEncoder.cpp +++ b/media/libstagefright/codecs/aacenc/AACEncoder.cpp @@ -209,7 +209,7 @@ status_t AACEncoder::read( CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), OK); uint8_t *outPtr = (uint8_t *)buffer->data(); bool readFromSource = false; - int64_t wallClockTimeUs = 0; + int64_t wallClockTimeUs = -1; if (mFrameCount == 0) { memcpy(outPtr, mAudioSpecificConfigData, 2); @@ -240,8 +240,9 @@ status_t AACEncoder::read( CHECK_EQ(align, 0); int64_t timeUs; - CHECK(mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)); - wallClockTimeUs = timeUs; + if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) { + wallClockTimeUs = timeUs; + } if (mInputBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) { mAnchorTimeUs = timeUs; } @@ -298,7 +299,7 @@ status_t AACEncoder::read( int64_t mediaTimeUs = ((mFrameCount - 1) * 1000000LL * kNumSamplesPerFrame) / mSampleRate; buffer->meta_data()->setInt64(kKeyTime, mAnchorTimeUs + mediaTimeUs); - if (readFromSource) { + if (readFromSource && wallClockTimeUs != -1) { buffer->meta_data()->setInt64(kKeyDriftTime, mediaTimeUs - wallClockTimeUs); } ++mFrameCount; |