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
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 @@
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 @@
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();