Merge mozilla-central to autoland.

This commit is contained in:
Cosmin Sabou 2019-01-15 12:41:53 +02:00
commit 5091172c56
4 changed files with 16 additions and 18 deletions

View File

@ -94,7 +94,7 @@ TEST(MP4Metadata, EmptyStream) {
TEST(MoofParser, EmptyStream) {
RefPtr<ByteStream> stream = new TestStream(nullptr, 0);
MoofParser parser(stream, 0, false, true);
MoofParser parser(stream, 0, false);
EXPECT_EQ(0u, parser.mOffset);
EXPECT_TRUE(parser.ReachedEnd());
@ -404,7 +404,7 @@ TEST(MoofParser, test_case_mp4) {
RefPtr<ByteStream> stream =
new TestStream(buffer.Elements(), buffer.Length());
MoofParser parser(stream, 0, false, true);
MoofParser parser(stream, 0, false);
EXPECT_EQ(0u, parser.mOffset) << tests[test].mFilename;
EXPECT_FALSE(parser.ReachedEnd()) << tests[test].mFilename;
EXPECT_TRUE(parser.mInitRange.IsEmpty()) << tests[test].mFilename;

View File

@ -526,8 +526,7 @@ class MP4ContainerParser : public ContainerParser,
// consumers of ParseStartAndEndTimestamps to add their timestamp offset
// manually. This allows the ContainerParser to be shared across different
// timestampOffsets.
mParser = new MoofParser(mStream, 0, /* aIsAudio = */ false,
/* aIsMultitrackParser */ true);
mParser = new MoofParser(mStream, 0, /* aIsAudio = */ false);
DDLINKCHILD("parser", mParser.get());
mInitData = new MediaByteBuffer();
mCompleteInitSegmentRange = MediaByteRange();

View File

@ -227,11 +227,11 @@ void MoofParser::ParseTrak(Box& aBox) {
if (box.IsType("tkhd")) {
tkhd = Tkhd(box);
} else if (box.IsType("mdia")) {
if (mIsMultitrackParser || tkhd.mTrackId == mTrex.mTrackId) {
if (!mTrex.mTrackId || tkhd.mTrackId == mTrex.mTrackId) {
ParseMdia(box, tkhd);
}
} else if (box.IsType("edts") &&
(mIsMultitrackParser || tkhd.mTrackId == mTrex.mTrackId)) {
(!mTrex.mTrackId || tkhd.mTrackId == mTrex.mTrackId)) {
mEdts = Edts(box);
}
}
@ -251,8 +251,12 @@ void MoofParser::ParseMvex(Box& aBox) {
for (Box box = aBox.FirstChild(); box.IsAvailable(); box = box.Next()) {
if (box.IsType("trex")) {
Trex trex = Trex(box);
if (mIsMultitrackParser || trex.mTrackId == mTrex.mTrackId) {
if (!mTrex.mTrackId || trex.mTrackId == mTrex.mTrackId) {
auto trackId = mTrex.mTrackId;
mTrex = trex;
// Keep the original trackId, as should it be 0 we want to continue
// parsing all tracks.
mTrex.mTrackId = trackId;
}
}
}
@ -295,8 +299,8 @@ void MoofParser::ParseStbl(Box& aBox) {
}
void MoofParser::ParseStsd(Box& aBox) {
if (mIsMultitrackParser) {
// If mIsMultitrackParser, then the parser is being used to read multiple
if (mTrex.mTrackId == 0) {
// If mTrex.mTrackId is 0, then the parser is being used to read multiple
// tracks metadata, and it is not a sane operation to try and map multiple
// sample description boxes, from different tracks, onto the parser, which
// is modeled around storing metadata for a single track.

View File

@ -267,18 +267,14 @@ DDLoggedTypeDeclName(MoofParser);
class MoofParser : public DecoderDoctorLifeLogger<MoofParser> {
public:
MoofParser(ByteStream* aSource, uint32_t aTrackId, bool aIsAudio,
bool aIsMultitrackParser = false)
MoofParser(ByteStream* aSource, uint32_t aTrackId, bool aIsAudio)
: mSource(aSource),
mOffset(0),
mTrex(aTrackId),
mIsAudio(aIsAudio),
mLastDecodeTime(0),
mIsMultitrackParser(aIsMultitrackParser) {
// Setting mIsMultitrackParser is a nasty work around for calculating
// the composition range for MSE that causes the parser to parse multiple
// tracks. Ideally we'd store an array of tracks with different metadata
// for each.
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.
DDLINKCHILD("source", aSource);
}
bool RebuildFragmentedIndex(const mozilla::MediaByteRangeSet& aByteRanges);
@ -330,7 +326,6 @@ class MoofParser : public DecoderDoctorLifeLogger<MoofParser> {
nsTArray<MediaByteRange> mMediaRanges;
bool mIsAudio;
uint64_t mLastDecodeTime;
bool mIsMultitrackParser;
};
} // namespace mozilla