mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1232313: [mp4] Use cumulative decode time if tfdt box is not present. r=kentuckyfriedtakahe
Per ISO 14496-12, the Track fragment decode time (tfdt) is optional. MozReview-Commit-ID: LNrMPYlkDvt --HG-- extra : rebase_source : fbacde893352db9248a3ebe6a62b2042eb3106b6
This commit is contained in:
parent
8ab1b34845
commit
aa950b3d46
@ -46,7 +46,7 @@ MoofParser::RebuildFragmentedIndex(BoxContext& aContext)
|
||||
mInitRange = MediaByteRange(0, box.Range().mEnd);
|
||||
ParseMoov(box);
|
||||
} else if (box.IsType("moof")) {
|
||||
Moof moof(box, mTrex, mMvhd, mMdhd, mEdts, mSinf, mIsAudio);
|
||||
Moof moof(box, mTrex, mMvhd, mMdhd, mEdts, mSinf, &mLastDecodeTime, mIsAudio);
|
||||
|
||||
if (!moof.IsValid() && !box.Next().IsAvailable()) {
|
||||
// Moof isn't valid abort search for now.
|
||||
@ -346,13 +346,13 @@ MoofParser::ParseEncrypted(Box& aBox)
|
||||
}
|
||||
}
|
||||
|
||||
Moof::Moof(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, bool aIsAudio)
|
||||
Moof::Moof(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, uint64_t* aDecodeTime, bool aIsAudio)
|
||||
: mRange(aBox.Range())
|
||||
, mMaxRoundingError(35000)
|
||||
{
|
||||
for (Box box = aBox.FirstChild(); box.IsAvailable(); box = box.Next()) {
|
||||
if (box.IsType("traf")) {
|
||||
ParseTraf(box, aTrex, aMvhd, aMdhd, aEdts, aSinf, aIsAudio);
|
||||
ParseTraf(box, aTrex, aMvhd, aMdhd, aEdts, aSinf, aDecodeTime, aIsAudio);
|
||||
}
|
||||
}
|
||||
if (IsValid()) {
|
||||
@ -425,8 +425,9 @@ Moof::ProcessCenc()
|
||||
}
|
||||
|
||||
void
|
||||
Moof::ParseTraf(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, bool aIsAudio)
|
||||
Moof::ParseTraf(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, uint64_t* aDecodeTime, bool aIsAudio)
|
||||
{
|
||||
MOZ_ASSERT(aDecodeTime);
|
||||
Tfhd tfhd(aTrex);
|
||||
Tfdt tfdt;
|
||||
for (Box box = aBox.FirstChild(); box.IsAvailable(); box = box.Next()) {
|
||||
@ -445,12 +446,9 @@ Moof::ParseTraf(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, S
|
||||
if (aTrex.mTrackId && tfhd.mTrackId != aTrex.mTrackId) {
|
||||
return;
|
||||
}
|
||||
if (!tfdt.IsValid()) {
|
||||
LOG(Moof, "Invalid tfdt dependency");
|
||||
return;
|
||||
}
|
||||
// Now search for TRUN boxes.
|
||||
uint64_t decodeTime = tfdt.mBaseMediaDecodeTime;
|
||||
uint64_t decodeTime =
|
||||
tfdt.IsValid() ? tfdt.mBaseMediaDecodeTime : *aDecodeTime;
|
||||
for (Box box = aBox.FirstChild(); box.IsAvailable(); box = box.Next()) {
|
||||
if (box.IsType("trun")) {
|
||||
if (ParseTrun(box, tfhd, aMvhd, aMdhd, aEdts, &decodeTime, aIsAudio)) {
|
||||
@ -461,6 +459,7 @@ Moof::ParseTraf(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, S
|
||||
}
|
||||
}
|
||||
}
|
||||
*aDecodeTime = decodeTime;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -173,7 +173,7 @@ private:
|
||||
class Moof : public Atom
|
||||
{
|
||||
public:
|
||||
Moof(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, bool aIsAudio);
|
||||
Moof(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, uint64_t* aDecoderTime, bool aIsAudio);
|
||||
bool GetAuxInfo(AtomType aType, nsTArray<MediaByteRange>* aByteRanges);
|
||||
void FixRounding(const Moof& aMoof);
|
||||
|
||||
@ -186,7 +186,8 @@ public:
|
||||
nsTArray<Saio> mSaios;
|
||||
|
||||
private:
|
||||
void ParseTraf(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, bool aIsAudio);
|
||||
// aDecodeTime is updated to the end of the parsed TRAF on return.
|
||||
void ParseTraf(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, Sinf& aSinf, uint64_t* aDecodeTime, bool aIsAudio);
|
||||
// aDecodeTime is updated to the end of the parsed TRUN on return.
|
||||
bool ParseTrun(Box& aBox, Tfhd& aTfhd, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts, uint64_t* aDecodeTime, bool aIsAudio);
|
||||
void ParseSaiz(Box& aBox);
|
||||
@ -203,6 +204,7 @@ public:
|
||||
, mOffset(0)
|
||||
, mTrex(aTrackId)
|
||||
, mIsAudio(aIsAudio)
|
||||
, mLastDecodeTime(0)
|
||||
{
|
||||
// Setting the mTrex.mTrackId to 0 is a nasty work around for calculating
|
||||
// the composition range for MSE. We need an array of tracks.
|
||||
@ -247,6 +249,7 @@ private:
|
||||
nsTArray<Moof> mMoofs;
|
||||
nsTArray<MediaByteRange> mMediaRanges;
|
||||
bool mIsAudio;
|
||||
uint64_t mLastDecodeTime;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user