Bug 1171330: P14. Add ContainerParser::FirstCompleteMediaHeader() method. r=kentuckyfriedtakahe

--HG--
extra : rebase_source : 6adaf84ce44a6024b5eb40672f3d8d9bb107432d
This commit is contained in:
Jean-Yves Avenard 2015-06-11 16:27:15 +10:00
parent 0a0c636147
commit bc7bec465a
4 changed files with 32 additions and 9 deletions

View File

@ -92,18 +92,24 @@ ContainerParser::InitData()
return mInitData;
}
MediaByteRange
ContainerParser::MediaSegmentRange()
{
return mCompleteMediaSegmentRange;
}
MediaByteRange
ContainerParser::InitSegmentRange()
{
return mCompleteInitSegmentRange;
}
MediaByteRange
ContainerParser::MediaHeaderRange()
{
return mCompleteMediaHeaderRange;
}
MediaByteRange
ContainerParser::MediaSegmentRange()
{
return mCompleteMediaSegmentRange;
}
class WebMContainerParser : public ContainerParser {
public:
explicit WebMContainerParser(const nsACString& aType)
@ -339,6 +345,7 @@ public:
mp4_demuxer::Interval<mp4_demuxer::Microseconds> compositionRange =
mParser->GetCompositionRange(byteRanges);
mCompleteMediaHeaderRange = mParser->FirstCompleteMediaHeader();
mCompleteMediaSegmentRange = mParser->FirstCompleteMediaSegment();
ErrorResult rv;
mResource->EvictData(mParser->mOffset, mParser->mOffset, rv);

View File

@ -52,10 +52,15 @@ public:
}
bool HasCompleteInitData();
// Return the byte range of the first complete media segment or an empty
// Returns the byte range of the first complete init segment, or an empty
// range if not complete.
MediaByteRange InitSegmentRange();
// Returns the byte range of the first complete media segment header,
// or an empty range if not complete.
MediaByteRange MediaHeaderRange();
// Returns the byte range of the first complete media segment or an empty
// range if not complete.
MediaByteRange MediaSegmentRange();
MediaByteRange InitSegmentRange();
static ContainerParser* CreateForMIMEType(const nsACString& aType);
@ -63,8 +68,9 @@ protected:
nsRefPtr<MediaLargeByteBuffer> mInitData;
nsRefPtr<SourceBufferResource> mResource;
bool mHasInitData;
MediaByteRange mCompleteMediaSegmentRange;
MediaByteRange mCompleteInitSegmentRange;
MediaByteRange mCompleteMediaHeaderRange;
MediaByteRange mCompleteMediaSegmentRange;
const nsCString mType;
};

View File

@ -81,6 +81,15 @@ MoofParser::RebuildFragmentedIndex(BoxContext& aContext)
return foundValidMoof;
}
MediaByteRange
MoofParser::FirstCompleteMediaHeader()
{
if (Moofs().IsEmpty()) {
return MediaByteRange();
}
return Moofs()[0].mRange;
}
MediaByteRange
MoofParser::FirstCompleteMediaSegment()
{

View File

@ -226,6 +226,7 @@ public:
bool BlockingReadNextMoof();
bool HasMetadata();
MediaByteRange FirstCompleteMediaSegment();
MediaByteRange FirstCompleteMediaHeader();
mozilla::MediaByteRange mInitRange;
nsRefPtr<Stream> mSource;