We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 280ef44 commit 2dad596Copy full SHA for 2dad596
packages/voice/src/receive/VoiceReceiver.ts
@@ -185,6 +185,14 @@ export class VoiceReceiver {
185
if (!stream) return;
186
187
if (this.connectionData.encryptionMode && this.connectionData.nonceBuffer && this.connectionData.secretKey) {
188
+ // As a guard, we shouldn't parse packets that (1) aren't voice packets and (2) are not in the right RTP version
189
+ // 0x78 (120) is the default Opus payload type, the marker bit is (largely) unused here by Discord
190
+ if (msg[1] !== 0x78) return;
191
+
192
+ // Ignore packets not in RTP version 2
193
+ const rtpVersion = msg[0]! >> 6;
194
+ if (rtpVersion !== 2) return;
195
196
try {
197
const packet = this.parsePacket(
198
msg,
0 commit comments