Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 219f1951 authored by James Dong's avatar James Dong
Browse files

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
parent a9e0ea58
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -428,7 +428,7 @@ status_t MPEG4Writer::addSource(const sp<MediaSource> &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();