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

Commit 169c286e authored by Andreas Huber's avatar Andreas Huber
Browse files

Make sure we have all the sample table metadata before declaring a track valid.

Change-Id: I2dfbc3e6017b5cd264e4cccfa47d19047b2e7f31
related-to-bug: 5178976
parent 8a976a86
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1687,6 +1687,11 @@ status_t MPEG4Extractor::verifyTrack(Track *track) {
        }
    }

    if (!track->sampleTable->isValid()) {
        // Make sure we have all the metadata we need.
        return ERROR_MALFORMED;
    }

    return OK;
}

+7 −0
Original line number Diff line number Diff line
@@ -84,6 +84,13 @@ SampleTable::~SampleTable() {
    mSampleIterator = NULL;
}

bool SampleTable::isValid() const {
    return mChunkOffsetOffset >= 0
        && mSampleToChunkOffset >= 0
        && mSampleSizeOffset >= 0
        && mTimeToSample != NULL;
}

status_t SampleTable::setChunkOffsetParams(
        uint32_t type, off64_t data_offset, size_t data_size) {
    if (mChunkOffsetOffset >= 0) {
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ class SampleTable : public RefBase {
public:
    SampleTable(const sp<DataSource> &source);

    bool isValid() const;

    // type can be 'stco' or 'co64'.
    status_t setChunkOffsetParams(
            uint32_t type, off64_t data_offset, size_t data_size);