From 788888ab9ad17f1c8d85d68656c617334feb4361 Mon Sep 17 00:00:00 2001 From: White Wolf Date: Wed, 23 Aug 2023 10:10:22 -0600 Subject: [PATCH] fix(TransformerGraph): Explicitly include input args for readable input cases instead of just for string input cases (#9793) Explicitly add input args for readable input cases instead of just for string input cases. Change also ensures that constant arrays are passed by value instead of by reference, preventing them from accidentally being modified. Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- packages/voice/src/audio/TransformerGraph.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/voice/src/audio/TransformerGraph.ts b/packages/voice/src/audio/TransformerGraph.ts index 8c3846567..6749c713f 100644 --- a/packages/voice/src/audio/TransformerGraph.ts +++ b/packages/voice/src/audio/TransformerGraph.ts @@ -151,7 +151,7 @@ const FFMPEG_PCM_EDGE: Omit = { cost: 2, transformer: (input) => new prism.FFmpeg({ - args: typeof input === 'string' ? ['-i', input, ...FFMPEG_PCM_ARGUMENTS] : FFMPEG_PCM_ARGUMENTS, + args: ['-i', typeof input === 'string' ? input : '-', ...FFMPEG_PCM_ARGUMENTS], }), }; @@ -182,7 +182,7 @@ if (canEnableFFmpegOptimizations()) { cost: 2, transformer: (input) => new prism.FFmpeg({ - args: typeof input === 'string' ? ['-i', input, ...FFMPEG_OPUS_ARGUMENTS] : FFMPEG_OPUS_ARGUMENTS, + args: ['-i', typeof input === 'string' ? input : '-', ...FFMPEG_OPUS_ARGUMENTS], }), }; getNode(StreamType.Arbitrary).addEdge(FFMPEG_OGG_EDGE);