Skip to content

🎥 Make videos programmatically with React

Fix VBO leak in blur cleanup by tracking buffer in BlurState

Jonny Burger9ece12439e21
diff --git a/packages/canvas-effects/src/blur/blur-runtime.ts b/packages/canvas-effects/src/blur/blur-runtime.ts
index a39b422fe5..7a7a52ca3b 100644
--- a/packages/canvas-effects/src/blur/blur-runtime.ts
+++ b/packages/canvas-effects/src/blur/blur-runtime.ts
@@ -9,6 +9,7 @@ export type BlurState = {
gl: WebGL2RenderingContext;
program: WebGLProgram;
vao: WebGLVertexArrayObject;
+ vbo: WebGLBuffer;
texture: WebGLTexture;
uRadius: WebGLUniformLocation | null;
uTexelSize: WebGLUniformLocation | null;
@@ -125,11 +126,12 @@ export const setupBlur = (
const uTexelSize = gl.getUniformLocation(program, 'uTexelSize');
const uSource = gl.getUniformLocation(program, 'uSource');
- return {gl, program, vao, texture, uRadius, uTexelSize, uSource};
+ return {gl, program, vao, vbo, texture, uRadius, uTexelSize, uSource};
};
export const cleanupBlur = (state: BlurState): void => {
- const {gl, program, vao, texture} = state;
+ const {gl, program, vao, vbo, texture} = state;
+ gl.deleteBuffer(vbo);
gl.deleteProgram(program);
gl.deleteVertexArray(vao);
gl.deleteTexture(texture);
diff --git a/packages/example/runlambda.sh b/packages/example/runlambda.sh
index edd4cff544..d7a6212774 100644
--- a/packages/example/runlambda.sh
+++ b/packages/example/runlambda.sh
@@ -9,4 +9,4 @@ cd example
bunx remotion lambda functions rmall -f
bunx remotion lambda functions deploy --memory=2048 --disk=10000
bunx remotion lambda sites create --site-name=testbed-v6 --log=verbose --enable-folder-expiry
-bunx remotion lambda render testbed-v6 NewVideo --log=verbose --delete-after="1-day" --api-key=rm_pub_9a996d341238eaa34e696b099968d8510420b9f6ba4aa0ee
\ No newline at end of file
+bunx remotion lambda render testbed-v6 html-in-canvas --log=verbose --delete-after="1-day" --api-key=rm_pub_9a996d341238eaa34e696b099968d8510420b9f6ba4aa0ee
\ No newline at end of file