From 219f195159f93d627af2b243732e3f9020511a46 Mon Sep 17 00:00:00 2001 From: James Dong Date: Tue, 7 Aug 2012 16:54:22 -0700 Subject: Make sure that the trackId starts from 1 o this patch avoids sending incorrect track events to applications because track events contain the trackId Change-Id: I1cf054da8ab413d31a5b7fe8ed729486d1475c46 --- media/libstagefright/MPEG4Writer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'media/libstagefright/MPEG4Writer.cpp') diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 5aad99f..86477ba 100755 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -428,7 +428,7 @@ status_t MPEG4Writer::addSource(const sp &source) { ALOGE("Attempt to add source AFTER recording is started"); return UNKNOWN_ERROR; } - Track *track = new Track(this, source, mTracks.size()); + Track *track = new Track(this, source, 1 + mTracks.size()); mTracks.push_back(track); return OK; @@ -2693,7 +2693,7 @@ void MPEG4Writer::Track::writeTkhdBox(time_t now) { mOwner->writeInt32(0x07); // version=0, flags=7 mOwner->writeInt32(now); // creation time mOwner->writeInt32(now); // modification time - mOwner->writeInt32(mTrackId + 1); // track id starts with 1 + mOwner->writeInt32(mTrackId); // track id starts with 1 mOwner->writeInt32(0); // reserved int64_t trakDurationUs = getDurationUs(); int32_t mvhdTimeScale = mOwner->getTimeScale(); -- cgit v1.1