зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1197125: [webm]. Don't load the entire webm in RAM. r=kinetik
Instead we parse it in chunks of 1MiB max.
This commit is contained in:
Родитель
ee6cc113c7
Коммит
549614ffc0
|
@ -415,9 +415,16 @@ void WebMBufferedState::UpdateIndex(const nsTArray<MediaByteRange>& aRanges, Med
|
|||
}
|
||||
}
|
||||
}
|
||||
nsRefPtr<MediaByteBuffer> bytes = aResource->MediaReadAt(offset, length);
|
||||
if(bytes) {
|
||||
while (length > 0) {
|
||||
static const uint32_t BLOCK_SIZE = 1048576;
|
||||
uint32_t block = std::min(length, BLOCK_SIZE);
|
||||
nsRefPtr<MediaByteBuffer> bytes = aResource->MediaReadAt(offset, block);
|
||||
if (!bytes) {
|
||||
break;
|
||||
}
|
||||
NotifyDataArrived(bytes->Elements(), bytes->Length(), offset);
|
||||
length -= bytes->Length();
|
||||
offset += bytes->Length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче