From f3a67554ff3c69b22e1e0193b0a4fb83d3f19969 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Fri, 23 Aug 2024 18:38:57 +0000 Subject: [PATCH] web/encode: skip reader if stream was skipped --- web/src/lib/libav/encode.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/lib/libav/encode.ts b/web/src/lib/libav/encode.ts index fd358462..c568d7fa 100644 --- a/web/src/lib/libav/encode.ts +++ b/web/src/lib/libav/encode.ts @@ -222,7 +222,11 @@ export default class EncodeLibAV extends LibAVWrapper { await libav.ff_write_multi(output_ctx, write_pkt, starterPackets); let writePromise = Promise.resolve(); - await Promise.all(pipes.map(async (_, i) => { + await Promise.all(pipes.map(async (pipe, i) => { + if (pipe === null) { + return; + } + while (true) { const { done, value } = await readers[i].read(); if (done) break;