diff options
author | James Dong <jdong@google.com> | 2010-09-01 18:48:35 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-09-01 20:45:39 -0700 |
commit | d707fcb3e29707ca4a5935c294ef0b38eb5aba5f (patch) | |
tree | 8f223d9d5656ba34a0fdfe2e7ee4992f7a0bf3e3 /include/media | |
parent | 9b93478fef2915a1d0cbb1fe17d2788ef8b5b230 (diff) | |
download | frameworks_av-d707fcb3e29707ca4a5935c294ef0b38eb5aba5f.zip frameworks_av-d707fcb3e29707ca4a5935c294ef0b38eb5aba5f.tar.gz frameworks_av-d707fcb3e29707ca4a5935c294ef0b38eb5aba5f.tar.bz2 |
Calculate audio media drift time from AudioSource
The problem was that the time to receive an output buffer
from an audio encoder is different because the encoder does not
need to read from the source for all output buffers. This leads
to large fluctuation in terms of wall clock duration between two
neighboring audio sample outputs from the audio encoder. As a
result, the media time for the video track after adjustment using
the drifting changes wildly sometimes.
This patch addresses this issue by only updating the media drift
time when an audio source input buffer is read. the wall clock
for the audio track is also calculated at the same time when
the input audio buffer is read at AudioSource.
bug - 2959800
Change-Id: I3174aa182f744784b540f0a7198524d4eee8bd7b
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/stagefright/AudioSource.h | 1 | ||||
-rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/MetaData.h | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/include/media/stagefright/AudioSource.h b/include/media/stagefright/AudioSource.h index 1af4254..a5cec78 100644 --- a/include/media/stagefright/AudioSource.h +++ b/include/media/stagefright/AudioSource.h @@ -72,6 +72,7 @@ private: int64_t mPrevSampleTimeUs; int64_t mTotalLostFrames; int64_t mPrevLostBytes; + int64_t mInitialReadTimeUs; MediaBufferGroup *mGroup; diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index 2412f6a..9716e98 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -132,7 +132,7 @@ private: // Adjust other track media clock (presumably wall clock) // based on audio track media clock with the drift time. int64_t mDriftTimeUs; - void addDriftTimeUs(int64_t driftTimeUs); + void setDriftTimeUs(int64_t driftTimeUs); int64_t getDriftTimeUs(); void lock(); diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h index 43354c2..3b31e68 100644 --- a/include/media/stagefright/MetaData.h +++ b/include/media/stagefright/MetaData.h @@ -48,6 +48,7 @@ enum { kKeyTime = 'time', // int64_t (usecs) kKeyNTPTime = 'ntpT', // uint64_t (ntp-timestamp) kKeyTargetTime = 'tarT', // int64_t (usecs) + kKeyDriftTime = 'dftT', // int64_t (usecs) kKeyDuration = 'dura', // int64_t (usecs) kKeyColorFormat = 'colf', kKeyPlatformPrivate = 'priv', // pointer |