Automatically close new VideoFrames created by toCanvasImageSource, reduce clones in mediaSamplesAtTimestamps

This commit is contained in:
Vanilagy
2025-05-09 15:31:18 +02:00
parent 8bca9b0217
commit 8de25036b8
5 changed files with 37 additions and 18 deletions
+15 -5
View File
@@ -60,7 +60,16 @@
6.933333333333334,
7.039999999999999,
7.1466666666666665,
7.253333333333333
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
7.253333333333333,
];
console.log(timestamps);
@@ -88,21 +97,22 @@
*/
/*
for (let i = 0; i < 1000; i++) {
for (let i = 0; i < 40; i++) {
const count = Math.floor(50 * Math.random());
const timestamps = Array.from({ length: count }, () => Math.random() * 20).sort((a, b) => a-b);
for await (const wrappedCanvas of sink.canvasesAtTimestamps(timestamps)) {
for await (const wrappedCanvas of sink.samplesAtTimestamps(timestamps)) {
//console.log(wrappedCanvas);
wrappedCanvas.close()
}
console.log("don")
}
console.log("DONE!")
*/