mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-06 07:06:02 +00:00
stream: use descriptive variables for i/o for better readability
This commit is contained in:
parent
aabde229ed
commit
58f7ed7827
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue