mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1125776: Part5. Limit metadata parsing to init segment size if known. r=kinetik
This commit is contained in:
parent
2f427e5bbc
commit
2020140397
@ -340,6 +340,7 @@ void WebMBufferedState::NotifyDataArrived(const char* aBuffer, uint32_t aLength,
|
||||
while (i + 1 < mRangeParsers.Length()) {
|
||||
if (mRangeParsers[i].mCurrentOffset >= mRangeParsers[i + 1].mStartOffset) {
|
||||
mRangeParsers[i + 1].mStartOffset = mRangeParsers[i].mStartOffset;
|
||||
mRangeParsers[i + 1].mInitEndOffset = mRangeParsers[i].mInitEndOffset;
|
||||
mRangeParsers.RemoveElementAt(i);
|
||||
} else {
|
||||
i += 1;
|
||||
@ -347,4 +348,12 @@ void WebMBufferedState::NotifyDataArrived(const char* aBuffer, uint32_t aLength,
|
||||
}
|
||||
}
|
||||
|
||||
int64_t WebMBufferedState::GetInitEndOffset()
|
||||
{
|
||||
if (mRangeParsers.IsEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
return mRangeParsers[0].mInitEndOffset;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -241,6 +241,9 @@ public:
|
||||
// dependencies to arrive at aTime.
|
||||
bool GetOffsetForTime(uint64_t aTime, int64_t* aOffset);
|
||||
|
||||
// Returns end offset of init segment or -1 if none found.
|
||||
int64_t GetInitEndOffset();
|
||||
|
||||
private:
|
||||
// Private destructor, to discourage deletion outside of Release():
|
||||
~WebMBufferedState() {
|
||||
|
@ -337,7 +337,7 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
||||
io.tell = webm_tell;
|
||||
io.userdata = mDecoder;
|
||||
int64_t maxOffset = mDecoder->HasInitializationData() ?
|
||||
mDecoder->GetResource()->GetLength() : -1;
|
||||
mBufferedState->GetInitEndOffset() : -1;
|
||||
int r = nestegg_init(&mContext, io, &webm_log, maxOffset);
|
||||
if (r == -1) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user