From f36088b48da34b49e456ad39be70f0326295aa2b Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Mon, 26 Aug 2024 19:19:52 +0000 Subject: [PATCH] web/remux,convert: shut down libav.js on page exit --- web/src/routes/convert/+page.svelte | 8 ++++++-- web/src/routes/remux/+page.svelte | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/src/routes/convert/+page.svelte b/web/src/routes/convert/+page.svelte index 2a4b9cde..42769f79 100644 --- a/web/src/routes/convert/+page.svelte +++ b/web/src/routes/convert/+page.svelte @@ -4,6 +4,7 @@ import DropReceiver from "$components/misc/DropReceiver.svelte"; import FileReceiver from "$components/misc/FileReceiver.svelte"; + import { onDestroy } from "svelte"; let file: File | undefined; @@ -13,8 +14,11 @@ const render = async () => { if (!file) return; await ff.init(); - await ff.transcode(file); - }; + + onDestroy(async () => { + await ff.cleanup(); + ff.shutdown(); + }); $: if (file) { render(); diff --git a/web/src/routes/remux/+page.svelte b/web/src/routes/remux/+page.svelte index bd87c1f9..83c568c3 100644 --- a/web/src/routes/remux/+page.svelte +++ b/web/src/routes/remux/+page.svelte @@ -2,6 +2,7 @@ import mime from "mime"; import LibAVWrapper from "$lib/libav/remux"; + import { onDestroy } from "svelte"; import { beforeNavigate, goto } from "$app/navigation"; import { t } from "$lib/i18n/translations"; @@ -102,6 +103,7 @@ }); return; } + console.log(file_info) totalDuration = Number(file_info.format.duration); @@ -193,6 +195,8 @@ $: if (file) { render(); } + + onDestroy(() => ff.shutdown());