Loading media/extractors/mp4/MPEG4Extractor.cpp +7 −28 Original line number Diff line number Diff line Loading @@ -165,9 +165,8 @@ private: status_t parseTrackFragmentRun(off64_t offset, off64_t size); status_t parseSampleAuxiliaryInformationSizes(off64_t offset, off64_t size); status_t parseSampleAuxiliaryInformationOffsets(off64_t offset, off64_t size); status_t parseClearEncryptedSizes( off64_t offset, bool isSubsampleEncryption, uint32_t flags, off64_t size); status_t parseSampleEncryption(off64_t offset, off64_t size); status_t parseClearEncryptedSizes(off64_t offset, bool isSubsampleEncryption, uint32_t flags); status_t parseSampleEncryption(off64_t offset); // returns -1 for invalid layer ID int32_t parseHEVCLayerId(const uint8_t *data, size_t size); Loading Loading @@ -5187,7 +5186,7 @@ status_t MPEG4Source::parseChunk(off64_t *offset) { case FOURCC("senc"): { status_t err; if ((err = parseSampleEncryption(data_offset, chunk_data_size)) != OK) { if ((err = parseSampleEncryption(data_offset)) != OK) { return err; } *offset += chunk_size; Loading Loading @@ -5379,13 +5378,12 @@ status_t MPEG4Source::parseSampleAuxiliaryInformationOffsets( off64_t drmoffset = mCurrentSampleInfoOffsets[0]; // from moof drmoffset += mCurrentMoofOffset; size -= mCurrentMoofOffset; return parseClearEncryptedSizes(drmoffset, false, 0, size); return parseClearEncryptedSizes(drmoffset, false, 0); } status_t MPEG4Source::parseClearEncryptedSizes( off64_t offset, bool isSubsampleEncryption, uint32_t flags, off64_t size) { off64_t offset, bool isSubsampleEncryption, uint32_t flags) { int32_t ivlength; if (!AMediaFormat_getInt32(mFormat, AMEDIAFORMAT_KEY_CRYPTO_DEFAULT_IV_SIZE, &ivlength)) { Loading @@ -5400,14 +5398,10 @@ status_t MPEG4Source::parseClearEncryptedSizes( uint32_t sampleCount = mCurrentSampleInfoCount; if (isSubsampleEncryption) { if(size < 4){ return ERROR_MALFORMED; } if (!mDataSource->getUInt32(offset, &sampleCount)) { return ERROR_IO; } offset += 4; size -= 4; } // read CencSampleAuxiliaryDataFormats Loading @@ -5422,15 +5416,11 @@ status_t MPEG4Source::parseClearEncryptedSizes( } memset(smpl->iv, 0, 16); if(size < ivlength){ return ERROR_MALFORMED; } if (mDataSource->readAt(offset, smpl->iv, ivlength) != ivlength) { return ERROR_IO; } offset += ivlength; size -= ivlength; bool readSubsamples; if (isSubsampleEncryption) { Loading @@ -5445,20 +5435,13 @@ status_t MPEG4Source::parseClearEncryptedSizes( if (readSubsamples) { uint16_t numsubsamples; if(size < 2){ return ERROR_MALFORMED; } if (!mDataSource->getUInt16(offset, &numsubsamples)) { return ERROR_IO; } offset += 2; size -= 2; for (size_t j = 0; j < numsubsamples; j++) { uint16_t numclear; uint32_t numencrypted; if(size < 6){ return ERROR_MALFORMED; } if (!mDataSource->getUInt16(offset, &numclear)) { return ERROR_IO; } Loading @@ -5467,7 +5450,6 @@ status_t MPEG4Source::parseClearEncryptedSizes( return ERROR_IO; } offset += 4; size -= 6; smpl->clearsizes.add(numclear); smpl->encryptedsizes.add(numencrypted); } Loading @@ -5480,15 +5462,12 @@ status_t MPEG4Source::parseClearEncryptedSizes( return OK; } status_t MPEG4Source::parseSampleEncryption(off64_t offset, off64_t chunk_data_size) { status_t MPEG4Source::parseSampleEncryption(off64_t offset) { uint32_t flags; if(chunk_data_size < 4) { return ERROR_MALFORMED; } if (!mDataSource->getUInt32(offset, &flags)) { // actually version + flags return ERROR_MALFORMED; } return parseClearEncryptedSizes(offset + 4, true, flags, chunk_data_size - 4); return parseClearEncryptedSizes(offset + 4, true, flags); } status_t MPEG4Source::parseTrackFragmentHeader(off64_t offset, off64_t size) { Loading Loading
media/extractors/mp4/MPEG4Extractor.cpp +7 −28 Original line number Diff line number Diff line Loading @@ -165,9 +165,8 @@ private: status_t parseTrackFragmentRun(off64_t offset, off64_t size); status_t parseSampleAuxiliaryInformationSizes(off64_t offset, off64_t size); status_t parseSampleAuxiliaryInformationOffsets(off64_t offset, off64_t size); status_t parseClearEncryptedSizes( off64_t offset, bool isSubsampleEncryption, uint32_t flags, off64_t size); status_t parseSampleEncryption(off64_t offset, off64_t size); status_t parseClearEncryptedSizes(off64_t offset, bool isSubsampleEncryption, uint32_t flags); status_t parseSampleEncryption(off64_t offset); // returns -1 for invalid layer ID int32_t parseHEVCLayerId(const uint8_t *data, size_t size); Loading Loading @@ -5187,7 +5186,7 @@ status_t MPEG4Source::parseChunk(off64_t *offset) { case FOURCC("senc"): { status_t err; if ((err = parseSampleEncryption(data_offset, chunk_data_size)) != OK) { if ((err = parseSampleEncryption(data_offset)) != OK) { return err; } *offset += chunk_size; Loading Loading @@ -5379,13 +5378,12 @@ status_t MPEG4Source::parseSampleAuxiliaryInformationOffsets( off64_t drmoffset = mCurrentSampleInfoOffsets[0]; // from moof drmoffset += mCurrentMoofOffset; size -= mCurrentMoofOffset; return parseClearEncryptedSizes(drmoffset, false, 0, size); return parseClearEncryptedSizes(drmoffset, false, 0); } status_t MPEG4Source::parseClearEncryptedSizes( off64_t offset, bool isSubsampleEncryption, uint32_t flags, off64_t size) { off64_t offset, bool isSubsampleEncryption, uint32_t flags) { int32_t ivlength; if (!AMediaFormat_getInt32(mFormat, AMEDIAFORMAT_KEY_CRYPTO_DEFAULT_IV_SIZE, &ivlength)) { Loading @@ -5400,14 +5398,10 @@ status_t MPEG4Source::parseClearEncryptedSizes( uint32_t sampleCount = mCurrentSampleInfoCount; if (isSubsampleEncryption) { if(size < 4){ return ERROR_MALFORMED; } if (!mDataSource->getUInt32(offset, &sampleCount)) { return ERROR_IO; } offset += 4; size -= 4; } // read CencSampleAuxiliaryDataFormats Loading @@ -5422,15 +5416,11 @@ status_t MPEG4Source::parseClearEncryptedSizes( } memset(smpl->iv, 0, 16); if(size < ivlength){ return ERROR_MALFORMED; } if (mDataSource->readAt(offset, smpl->iv, ivlength) != ivlength) { return ERROR_IO; } offset += ivlength; size -= ivlength; bool readSubsamples; if (isSubsampleEncryption) { Loading @@ -5445,20 +5435,13 @@ status_t MPEG4Source::parseClearEncryptedSizes( if (readSubsamples) { uint16_t numsubsamples; if(size < 2){ return ERROR_MALFORMED; } if (!mDataSource->getUInt16(offset, &numsubsamples)) { return ERROR_IO; } offset += 2; size -= 2; for (size_t j = 0; j < numsubsamples; j++) { uint16_t numclear; uint32_t numencrypted; if(size < 6){ return ERROR_MALFORMED; } if (!mDataSource->getUInt16(offset, &numclear)) { return ERROR_IO; } Loading @@ -5467,7 +5450,6 @@ status_t MPEG4Source::parseClearEncryptedSizes( return ERROR_IO; } offset += 4; size -= 6; smpl->clearsizes.add(numclear); smpl->encryptedsizes.add(numencrypted); } Loading @@ -5480,15 +5462,12 @@ status_t MPEG4Source::parseClearEncryptedSizes( return OK; } status_t MPEG4Source::parseSampleEncryption(off64_t offset, off64_t chunk_data_size) { status_t MPEG4Source::parseSampleEncryption(off64_t offset) { uint32_t flags; if(chunk_data_size < 4) { return ERROR_MALFORMED; } if (!mDataSource->getUInt32(offset, &flags)) { // actually version + flags return ERROR_MALFORMED; } return parseClearEncryptedSizes(offset + 4, true, flags, chunk_data_size - 4); return parseClearEncryptedSizes(offset + 4, true, flags); } status_t MPEG4Source::parseTrackFragmentHeader(off64_t offset, off64_t size) { Loading