summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-09-03 15:42:09 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-03 15:42:09 -0700
commitddba3f0424340869f7819153cc8c1037caf62919 (patch)
treeea84ab7d8c135b59f5bed44e79cf0bc35943b72f /media
parent8ae49d87b98d57d6758b0c51b95e28a6581a79f1 (diff)
parentcaa68a57f0b358b8fbe17447ffa453b9120a8610 (diff)
downloadframeworks_av-ddba3f0424340869f7819153cc8c1037caf62919.zip
frameworks_av-ddba3f0424340869f7819153cc8c1037caf62919.tar.gz
frameworks_av-ddba3f0424340869f7819153cc8c1037caf62919.tar.bz2
Merge "Not all audio source has the drift time information" into gingerbread
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/codecs/aacenc/AACEncoder.cpp9
-rw-r--r--media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp9
-rw-r--r--media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp9
3 files changed, 15 insertions, 12 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;
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);
}
diff --git a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
index b62eb5b..cd28413 100644
--- a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
+++ b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
@@ -199,7 +199,7 @@ status_t AMRWBEncoder::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) {
@@ -221,8 +221,9 @@ status_t AMRWBEncoder::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;
}
@@ -285,7 +286,7 @@ status_t AMRWBEncoder::read(
int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
buffer->meta_data()->setInt64(kKeyTime, mAnchorTimeUs + mediaTimeUs);
- if (readFromSource) {
+ if (readFromSource && wallClockTimeUs != -1) {
buffer->meta_data()->setInt64(kKeyDriftTime, mediaTimeUs - wallClockTimeUs);
}