mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-13 14:16:25 +01:00
web/workers/remux: init libav only once, terminate after usage
This commit is contained in:
parent
ff62a4c2e6
commit
564fc65297
1 changed files with 17 additions and 17 deletions
|
@ -11,7 +11,10 @@ const error = (code: string) => {
|
|||
})
|
||||
}
|
||||
|
||||
const ff = new LibAVWrapper((progress) => {
|
||||
const remux = async (files: CobaltFileReference[], args: string[], output: FileInfo) => {
|
||||
if (!(files && output && args)) return;
|
||||
|
||||
const ff = new LibAVWrapper((progress) => {
|
||||
self.postMessage({
|
||||
cobaltRemuxWorker: {
|
||||
progress: {
|
||||
|
@ -23,14 +26,9 @@ const ff = new LibAVWrapper((progress) => {
|
|||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
ff.init();
|
||||
|
||||
const remux = async (files: CobaltFileReference[], args: string[], output: FileInfo) => {
|
||||
if (!(files && output && args)) return;
|
||||
|
||||
await ff.init();
|
||||
ff.init();
|
||||
|
||||
try {
|
||||
// probing just the first file in files array (usually audio) for duration progress
|
||||
|
@ -84,6 +82,8 @@ const remux = async (files: CobaltFileReference[], args: string[], output: FileI
|
|||
return error("incorrect input or output");
|
||||
}
|
||||
|
||||
await ff.terminate();
|
||||
|
||||
self.postMessage({
|
||||
cobaltRemuxWorker: {
|
||||
render
|
||||
|
|
Loading…
Reference in a new issue