From 58f7ed7827131aed59e4039e77606d095a5bf9bf Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sun, 5 Nov 2023 22:16:49 +0000 Subject: [PATCH] stream: use descriptive variables for i/o for better readability --- src/modules/stream/types.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js index 8a1afd7..a926098 100644 --- a/src/modules/stream/types.js +++ b/src/modules/stream/types.js @@ -88,12 +88,13 @@ export async function streamLiveRender(streamInfo, res) { 'pipe', 'pipe' ], }); + const [,,, audioInput, muxOutput] = process.stdio; res.setHeader('Connection', 'keep-alive'); res.setHeader('Content-Disposition', contentDisposition(streamInfo.filename)); - pipe(audio, process.stdio[3], shutdown); - pipe(process.stdio[4], res, shutdown); + pipe(audio, audioInput, shutdown); + pipe(muxOutput, res, shutdown); process.on('close', shutdown); res.on('finish', shutdown); @@ -137,10 +138,11 @@ export function streamAudioOnly(streamInfo, res) { 'pipe' ], }); + const [,,, muxOutput] = process.stdio; res.setHeader('Connection', 'keep-alive'); res.setHeader('Content-Disposition', contentDisposition(`${streamInfo.filename}.${streamInfo.audioFormat}`)); - pipe(process.stdio[3], res, shutdown); + pipe(muxOutput, res, shutdown); res.on('finish', shutdown); } catch { shutdown(); @@ -169,10 +171,11 @@ export function streamVideoOnly(streamInfo, res) { 'pipe' ], }); + const [,,, muxOutput] = process.stdio; res.setHeader('Connection', 'keep-alive'); res.setHeader('Content-Disposition', contentDisposition(streamInfo.filename)); - pipe(process.stdio[3], res, shutdown); + pipe(muxOutput, res, shutdown); process.on('close', shutdown); res.on('finish', shutdown);