Migrate fragmented MP4 reading to new packet system, add tests for it, add packet internal data, and various other fixes prob

This commit is contained in:
Vanilagy
2025-12-21 19:11:46 +01:00
parent 00efb69a7d
commit 6722592e27
10 changed files with 327 additions and 267 deletions
+20 -3
View File
@@ -11,11 +11,26 @@
const file = fileInput.files[0];
const input = new Mediabunny.Input({
formats: Mediabunny.ALL_FORMATS,
source: new Mediabunny.BlobSource(file),
source: new Mediabunny.BufferSource(await file.arrayBuffer()),
});
const videoTrack = await input.getPrimaryVideoTrack();
const cursor = await Mediabunny.VideoSampleCursor2.init(videoTrack);
const iters = 50;
let total = 0;
for (let i = 0; i < iters; i++) {
const start = performance.now();
let count = 0;
const reader = new Mediabunny.PacketCursor(videoTrack);
await reader.iterate(() => count++);
console.log(count)
total += performance.now() - start;
}
alert(total / iters);
/*
console.log(await cursor.seekTo(2.00));
@@ -27,6 +42,7 @@
//console.log(await cursor.seekTo(5.1))
//return;
/*
const mh = [
cursor.seekTo(2.05),
//cursor.seekTo(4.9),
@@ -61,6 +77,7 @@
//cursor.close(),
//cursor.seekTo(2.00),
];
*/
/*
for (const yo of mh) {
@@ -72,7 +89,7 @@
console.log("done")
*/
console.log(await Promise.all(mh));
//console.log(await Promise.all(mh));
//console.log(await cursor.seekTo(2.05));
//console.log(await cursor.seekTo(2.10));