Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix crash on input stream error

Chocobozzzd19843bd42f2
diff --git a/server/core/lib/video-download.ts b/server/core/lib/video-download.ts
index 3d80811548..7eeb3ea1ee 100644
--- a/server/core/lib/video-download.ts
+++ b/server/core/lib/video-download.ts
@@ -92,19 +92,22 @@ export class VideoDownload {
const throttlePipeline = throttleStream
? pipeline(throttleStream, output)
- : undefined
+ : Promise.resolve()
try {
- await this.ffmpegContainer.mergeInputs({
- inputs: this.inputs,
- output: finalOutput,
- logError: false,
-
- // Include a cover if this is an audio file
- coverPath
- })
-
- if (throttleStream) await throttlePipeline
+ // Run in parallel to prevent throttlePipeline unhandled rejection if an input stream errors
+ await Promise.all([
+ this.ffmpegContainer.mergeInputs({
+ inputs: this.inputs,
+ output: finalOutput,
+ logError: false,
+
+ // Include a cover if this is an audio file
+ coverPath
+ }),
+
+ throttlePipeline
+ ])
logger.info(`Mux ended for video ${this.video.url}`, { inputs: this.inputsToLog(), ...lTags(this.video.uuid) })