|
@@ -15,7 +15,6 @@ import (
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"net"
|
|
|
- "runtime"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"sync"
|
|
@@ -660,8 +659,6 @@ func (v *VoiceConnection) opusSender(udpConn *net.UDPConn, close <-chan struct{}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- runtime.LockOSThread()
|
|
|
-
|
|
|
// VoiceConnection is now ready to receive audio packets
|
|
|
// TODO: this needs reviewed as I think there must be a better way.
|
|
|
v.Lock()
|
|
@@ -800,7 +797,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
|
|
|
}
|
|
|
|
|
@@ -814,6 +811,11 @@ 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 {
|
|
|
select {
|
|
|
case c <- &p:
|