web/encode: expect cleanup() to be called before libav is initialized
This commit is contained in:
parent
050375526f
commit
2b987a6efb
1 changed files with 6 additions and 3 deletions
|
@ -47,15 +47,18 @@ export default class EncodeLibAV extends LibAVWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
async cleanup() {
|
async cleanup() {
|
||||||
const { libav } = await this.#get();
|
let libav;
|
||||||
|
try {
|
||||||
|
({ libav } = await this.#get());
|
||||||
|
} catch {}
|
||||||
|
|
||||||
if (this.#has_file) {
|
if (this.#has_file) {
|
||||||
await libav.unlinkreadaheadfile('input');
|
if (libav) await libav.unlinkreadaheadfile('input');
|
||||||
this.#has_file = false;
|
this.#has_file = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.#fmt_ctx) {
|
if (this.#fmt_ctx) {
|
||||||
await libav.avformat_close_input_js(this.#fmt_ctx);
|
if (libav) await libav.avformat_close_input_js(this.#fmt_ctx);
|
||||||
this.#fmt_ctx = undefined;
|
this.#fmt_ctx = undefined;
|
||||||
this.#istreams = undefined;
|
this.#istreams = undefined;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue