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

Commit ee0846f9 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

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

parents 1e7d2ba8 169c286e
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);