mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-01 21:03:46 +02:00
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:
+20
-3
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user