From caa68a57f0b358b8fbe17447ffa453b9120a8610 Mon Sep 17 00:00:00 2001 From: James Dong Date: Fri, 3 Sep 2010 12:01:55 -0700 Subject: Not all audio source has the drift time information Change-Id: I74e502376348ca4a6ffaa7492bed35c1355e7e62 --- media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'media/libstagefright/codecs/amrnb/enc') diff --git a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp index dab1390..858e6d0 100644 --- a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp +++ b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp @@ -148,7 +148,7 @@ status_t AMRNBEncoder::read( ReadOptions::SeekMode mode; CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode)); bool readFromSource = false; - int64_t wallClockTimeUs = 0; + int64_t wallClockTimeUs = -1; while (mNumInputSamples < kNumSamplesPerFrame) { if (mInputBuffer == NULL) { @@ -171,8 +171,9 @@ status_t AMRNBEncoder::read( readFromSource = true; 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; } @@ -227,7 +228,7 @@ status_t AMRNBEncoder::read( buffer->meta_data()->setInt64( kKeyTime, mAnchorTimeUs + mediaTimeUs); - if (readFromSource) { + if (readFromSource && wallClockTimeUs != -1) { buffer->meta_data()->setInt64(kKeyDriftTime, mediaTimeUs - wallClockTimeUs); } -- cgit v1.1