aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/bwmarrin/discordgo/voice.go
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2022-03-17 09:43:29 -0700
committerJordan <me@jordan.im>2022-03-17 09:43:29 -0700
commit66bfe530b4fd5cb9755337ce718df26ee81f1b77 (patch)
tree9dfc8a79183b8bffc12db5a92f957e3bfd37d4f2 /vendor/github.com/bwmarrin/discordgo/voice.go
parent2f0b35e3c25bc4394f3288e1baa77d250cb510ed (diff)
downloadkeep-66bfe530b4fd5cb9755337ce718df26ee81f1b77.tar.gz
keep-66bfe530b4fd5cb9755337ce718df26ee81f1b77.zip
misc: go get -u ./... ; go mod vendor
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/voice.go')
-rw-r--r--vendor/github.com/bwmarrin/discordgo/voice.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/voice.go b/vendor/github.com/bwmarrin/discordgo/voice.go
index dbafd83..aedb879 100644
--- a/vendor/github.com/bwmarrin/discordgo/voice.go
+++ b/vendor/github.com/bwmarrin/discordgo/voice.go
@@ -831,9 +831,15 @@ func (v *VoiceConnection) opusReceiver(udpConn *net.UDPConn, close <-chan struct
copy(nonce[:], recvbuf[0:12])
p.Opus, _ = secretbox.Open(nil, recvbuf[12:rlen], &nonce, &v.op4.SecretKey)
- if len(p.Opus) > 8 && recvbuf[0] == 0x90 {
- // Extension bit is set, first 8 bytes is the extended header
- p.Opus = p.Opus[8:]
+ // extension bit set, and not a RTCP packet
+ if ((recvbuf[0] & 0x10) == 0x10) && ((recvbuf[1] & 0x80) == 0) {
+ // get extended header length
+ extlen := binary.BigEndian.Uint16(p.Opus[2:4])
+ // 4 bytes (ext header header) + 4*extlen (ext header data)
+ shift := int(4 + 4*extlen)
+ if len(p.Opus) > shift {
+ p.Opus = p.Opus[shift:]
+ }
}
if c != nil {