4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-27 06:29:24 +00:00

Update vendor (bwmarrin/discordgo) apiv6

This commit is contained in:
Wim
2017-09-11 23:23:54 +02:00
parent 812db2d267
commit 49204cafcc
12 changed files with 472 additions and 116 deletions

View File

@ -796,7 +796,7 @@ func (v *VoiceConnection) opusReceiver(udpConn *net.UDPConn, close <-chan struct
}
// For now, skip anything except audio.
if rlen < 12 || recvbuf[0] != 0x80 {
if rlen < 12 || (recvbuf[0] != 0x80 && recvbuf[0] != 0x90) {
continue
}
@ -810,8 +810,17 @@ 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:]
}
if c != nil {
c <- &p
select {
case c <- &p:
case <-close:
return
}
}
}
}