From c1f4b2b73fe9432cb75ce1dd368475a2867e70ed Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 17 Jun 2014 14:48:32 -0700 Subject: Parse trex and mehd boxes Also get duration from mvhd if available, use that in addition to track durations to determine total length of file, clear track header struct so we don't read uninitialized garbage from it, and take composition time offset into account for proper ordering when B frames are used. b/15669839 Change-Id: Ibf3e35b5c7299bac11d0e78a391545fc325dd2d0 --- media/libstagefright/AwesomePlayer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'media/libstagefright/AwesomePlayer.cpp') diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index d679be1..f35a5b1 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -408,6 +408,13 @@ status_t AwesomePlayer::setDataSource_l(const sp &extractor) { totalBitRate += bitrate; } + sp fileMeta = mExtractor->getMetaData(); + if (fileMeta != NULL) { + int64_t duration; + if (fileMeta->findInt64(kKeyDuration, &duration)) { + mDurationUs = duration; + } + } mBitrate = totalBitRate; -- cgit v1.1