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

Commit a3e5d028 authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Merge "Determine frame rate from trex box if stsz box is empty" into nyc-dev

am: e0c4cfee

* commit 'e0c4cfee':
  Determine frame rate from trex box if stsz box is empty

Change-Id: Ifcdfea63a35b3a198bf41e7f9adfc24555271bc1
parents dde6ac2a e0c4cfee
Loading
Loading
Loading
Loading
+24 −7
Original line number Diff line number Diff line
@@ -1560,6 +1560,22 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
            // Calculate average frame rate.
            if (!strncasecmp("video/", mime, 6)) {
                size_t nSamples = mLastTrack->sampleTable->countSamples();
                if (nSamples == 0) {
                    int32_t trackId;
                    if (mLastTrack->meta->findInt32(kKeyTrackID, &trackId)) {
                        for (size_t i = 0; i < mTrex.size(); i++) {
                            Trex *t = &mTrex.editItemAt(i);
                            if (t->track_ID == (uint32_t) trackId) {
                                if (t->default_sample_duration > 0) {
                                    int32_t frameRate =
                                            mLastTrack->timescale / t->default_sample_duration;
                                    mLastTrack->meta->setInt32(kKeyFrameRate, frameRate);
                                }
                                break;
                            }
                        }
                    }
                } else {
                    int64_t durationUs;
                    if (mLastTrack->meta->findInt64(kKeyDuration, &durationUs)) {
                        if (durationUs > 0) {
@@ -1569,6 +1585,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                        }
                    }
                }
            }

            break;
        }
@@ -2929,7 +2946,7 @@ sp<IMediaSource> MPEG4Extractor::getTrack(size_t index) {
    int32_t trackId;
    if (track->meta->findInt32(kKeyTrackID, &trackId)) {
        for (size_t i = 0; i < mTrex.size(); i++) {
            Trex *t = &mTrex.editItemAt(index);
            Trex *t = &mTrex.editItemAt(i);
            if (t->track_ID == (uint32_t) trackId) {
                trex = t;
                break;