diff --git a/dom/media/fmp4/MP4Reader.cpp b/dom/media/fmp4/MP4Reader.cpp index 4b57c435280..624d413120b 100644 --- a/dom/media/fmp4/MP4Reader.cpp +++ b/dom/media/fmp4/MP4Reader.cpp @@ -688,7 +688,9 @@ MP4Reader::ResetDecode() { MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn()); Flush(kVideo); + mDemuxer->SeekVideo(0); Flush(kAudio); + mDemuxer->SeekAudio(0); return MediaDecoderReader::ResetDecode(); } diff --git a/media/libstagefright/binding/MoofParser.cpp b/media/libstagefright/binding/MoofParser.cpp index 25d2121f6bf..cdff54d93a5 100644 --- a/media/libstagefright/binding/MoofParser.cpp +++ b/media/libstagefright/binding/MoofParser.cpp @@ -4,6 +4,7 @@ #include "mp4_demuxer/MoofParser.h" #include "mp4_demuxer/Box.h" +#include namespace mp4_demuxer { @@ -72,10 +73,8 @@ bool MoofParser::BlockingReadNextMoof() { nsTArray byteRanges; - int64_t size; - bool hasSize = mSource->Length(&size); byteRanges.AppendElement( - MediaByteRange(0,hasSize ? size : std::numeric_limits::max())); + MediaByteRange(0, std::numeric_limits::max())); mp4_demuxer::BlockingStream* stream = new BlockingStream(mSource); BoxContext context(stream, byteRanges); @@ -334,7 +333,7 @@ Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Tfdt& aTfdt, Mdhd& aMdhd, Edts& aEdts) sample.mByteRange = MediaByteRange(offset, offset + sampleSize); offset += sampleSize; - sample.mDecodeTime = decodeTime; + sample.mDecodeTime = aMdhd.ToMicroseconds(decodeTime); sample.mCompositionRange = Interval( aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset - aEdts.mMediaStart), aMdhd.ToMicroseconds((int64_t)decodeTime + ctsOffset + sampleDuration - aEdts.mMediaStart)); diff --git a/media/libstagefright/binding/mp4_demuxer.cpp b/media/libstagefright/binding/mp4_demuxer.cpp index 2d13d09e854..6a39719b58e 100644 --- a/media/libstagefright/binding/mp4_demuxer.cpp +++ b/media/libstagefright/binding/mp4_demuxer.cpp @@ -111,7 +111,7 @@ MP4Demuxer::Init() nsRefPtr index = new Index(mPrivate->mAudio->exportIndex(), mSource, mAudioConfig.mTrackId); mPrivate->mIndexes.AppendElement(index); - if (index->IsFragmented()) { + if (index->IsFragmented() && !mAudioConfig.crypto.valid) { mPrivate->mAudioIterator = new SampleIterator(index); } } else if (!mPrivate->mVideo.get() && !strncmp(mimeType, "video/", 6)) { @@ -124,7 +124,7 @@ MP4Demuxer::Init() nsRefPtr index = new Index(mPrivate->mVideo->exportIndex(), mSource, mVideoConfig.mTrackId); mPrivate->mIndexes.AppendElement(index); - if (index->IsFragmented()) { + if (index->IsFragmented() && !mVideoConfig.crypto.valid) { mPrivate->mVideoIterator = new SampleIterator(index); } }