From 25eb3f6353d91a8550523ce8dc7f5d936fe10ed1 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Mon, 8 Jun 2026 21:45:26 +0700 Subject: [PATCH] fix(voice): remove OggDemuxer from transmitter pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Opus.Encoder in prism-media outputs raw Opus packets directly, no OGG wrapping. OggDemuxer was breaking the stream by trying to unwrap a non-existent OGG container. Pipeline was: PCM → Encoder → OggDemuxer → Discord (broken) Pipeline now: PCM → Encoder → Discord (correct) Co-Authored-By: Claude Opus 4.8 --- .../src/modules/voice-recording/transmitter.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/services/discord-gateway/src/modules/voice-recording/transmitter.ts b/services/discord-gateway/src/modules/voice-recording/transmitter.ts index c6cad8f..4c4a114 100644 --- a/services/discord-gateway/src/modules/voice-recording/transmitter.ts +++ b/services/discord-gateway/src/modules/voice-recording/transmitter.ts @@ -36,19 +36,16 @@ export class VoiceTransmitter { // Upsample 24kHz mono → 48kHz stereo const upsampledStream = this.upsampleTo48kStereo(this.pcmStream); - // Encode to Opus and wrap in OGG container + // Encode to Opus — Encoder outputs raw Opus packets (no OGG wrapper needed) this.opusEncoder = new prism.opus.Encoder({ rate: 48000, channels: 2, frameSize: 960, }); - const oggDemuxer = new prism.opus.OggDemuxer(); - const opusStream = upsampledStream - .pipe(this.opusEncoder) - .pipe(oggDemuxer); + const opusStream = upsampledStream.pipe(this.opusEncoder); - // Play to Discord with Opus format (raw Opus packets) + // Play to Discord with raw Opus format discordPlayer.playStream(opusStream, "browser-bridge", { inputType: StreamType.Opus, inlineVolume: true,