Bug 1111311: Use 32 bits signed for storing CTS in order to properly calculate PTS. r=kentuckyfriedtakahe

This commit is contained in:
Jean-Yves Avenard 2014-12-17 22:21:10 +11:00
parent 66dac7ece8
commit 82b860da6b
2 changed files with 4 additions and 12 deletions

View File

@ -318,13 +318,9 @@ Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Tfdt& aTfdt, Mdhd& aMdhd, Edts& aEdts)
flags & 0x400 ? reader->ReadU32() : hasFirstSampleFlags && i == 0
? firstSampleFlags
: aTfhd.mDefaultSampleFlags;
int64_t ctsOffset = 0;
int32_t ctsOffset = 0;
if (flags & 0x800) {
if (version == 0) {
ctsOffset = reader->ReadU32();
} else {
ctsOffset = reader->Read32();
}
ctsOffset = reader->Read32();
}
Sample sample;

View File

@ -140,7 +140,7 @@ private:
off64_t offset;
uint32_t size;
uint32_t duration;
int64_t ctsOffset;
int32_t ctsOffset;
uint32_t flags;
uint8_t iv[16];
Vector<uint16_t> clearsizes;
@ -3161,11 +3161,7 @@ status_t MPEG4Source::parseTrackFragmentRun(off64_t offset, off64_t size) {
tmp.offset = dataOffset;
tmp.size = sampleSize;
tmp.duration = sampleDuration;
if (version == 0) {
tmp.ctsOffset = sampleCtsOffset;
} else {
tmp.ctsOffset = (int32_t)sampleCtsOffset;
}
tmp.ctsOffset = (int32_t)sampleCtsOffset;
mCurrentSamples.add(tmp);
dataOffset += sampleSize;