Bug 1133478: Postpone parsing TRUN atom until we have all dependent atoms. r=k17e

Atoms may be out of order inside MOOF, in particular the TFDT may only be
defined after TRUN.
This commit is contained in:
Jean-Yves Avenard 2015-02-17 16:22:52 +13:00
Родитель 31151f0376
Коммит 6dffa7b1fa
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -301,8 +301,6 @@ Moof::ParseTraf(Box& aBox, Trex& aTrex, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf)
} else if (!aTrex.mTrackId || tfhd.mTrackId == aTrex.mTrackId) {
if (box.IsType("tfdt")) {
tfdt = Tfdt(box);
} else if (box.IsType("trun")) {
ParseTrun(box, tfhd, tfdt, aMdhd, aEdts);
} else if (box.IsType("saiz")) {
mSaizs.AppendElement(Saiz(box, aSinf.mDefaultEncryptionType));
} else if (box.IsType("saio")) {
@ -310,6 +308,18 @@ Moof::ParseTraf(Box& aBox, Trex& aTrex, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf)
}
}
}
if (aTrex.mTrackId && tfhd.mTrackId != aTrex.mTrackId) {
return;
}
// Now search for TRUN box.
for (Box box = aBox.FirstChild(); box.IsAvailable(); box = box.Next()) {
if (box.IsType("trun")) {
ParseTrun(box, tfhd, tfdt, aMdhd, aEdts);
if (IsValid()) {
break;
}
}
}
}
void