зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1139271: Part3. Only consider a Box to be available if entire content is available. r=k17e
This commit is contained in:
Родитель
306c482476
Коммит
e939a4d7a8
|
@ -90,6 +90,12 @@ Box::Box(BoxContext* aContext, uint64_t aOffset, const Box* aParent)
|
|||
!byteRange->Contains(boxRange)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<uint8_t> content;
|
||||
if (!Read(&content, boxRange)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRange = boxRange;
|
||||
}
|
||||
|
||||
|
@ -114,10 +120,16 @@ Box::FirstChild() const
|
|||
return Box(mContext, mChildOffset, this);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Box::Read(nsTArray<uint8_t>* aDest)
|
||||
{
|
||||
aDest->SetLength(mRange.mEnd - mChildOffset);
|
||||
return Read(aDest, mRange);
|
||||
}
|
||||
|
||||
bool
|
||||
Box::Read(nsTArray<uint8_t>* aDest, const MediaByteRange& aRange)
|
||||
{
|
||||
aDest->SetLength(aRange.mEnd - mChildOffset);
|
||||
size_t bytes;
|
||||
if (!mContext->mSource->CachedReadAt(mChildOffset, aDest->Elements(),
|
||||
aDest->Length(), &bytes) ||
|
||||
|
@ -125,6 +137,8 @@ Box::Read(nsTArray<uint8_t>* aDest)
|
|||
// Byte ranges are being reported incorrectly
|
||||
NS_WARNING("Read failed in mp4_demuxer::Box::Read()");
|
||||
aDest->Clear();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,8 @@ public:
|
|||
|
||||
Box Next() const;
|
||||
Box FirstChild() const;
|
||||
void Read(nsTArray<uint8_t>* aDest);
|
||||
bool Read(nsTArray<uint8_t>* aDest);
|
||||
bool Read(nsTArray<uint8_t>* aDest, const MediaByteRange& aRange);
|
||||
|
||||
private:
|
||||
bool Contains(MediaByteRange aRange) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче