share vp8 config push and ice resolve, fix vk ice hosts, widen kick greps
This commit is contained in:
1 parent
2f366b1128
commit
69de2bd8b7
10 files changed
+83
-162
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package tunnel
|
||||
|
||||
import "encoding/binary"
|
||||
import (
|
||||
"encoding/binary"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
MsgConnect byte = 0x01
|
||||
@@ -14,6 +17,8 @@ const (
|
||||
MsgConfigAck byte = 0x09
|
||||
|
||||
WireHeaderLen = 4 + 1
|
||||
|
||||
configResendPeriod = 3 * time.Second
|
||||
)
|
||||
|
||||
const ControlConnID uint32 = 0
|
||||
@@ -64,6 +69,26 @@ func DecodeVP8Config(payload []byte) (fps, batch, trackCount int, ok bool) {
|
||||
return fps, batch, trackCount, true
|
||||
}
|
||||
|
||||
func SendVP8ConfigUntilAcked(acked, cancel, stopCh <-chan struct{}, tun DataTunnel, fps, batch, trackCount int, logFn func(string, ...any), logPrefix string) {
|
||||
tun.SendData(EncodeVP8Config(fps, batch, trackCount))
|
||||
ticker := time.NewTicker(configResendPeriod)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-acked:
|
||||
return
|
||||
case <-cancel:
|
||||
return
|
||||
case <-stopCh:
|
||||
return
|
||||
case <-ticker.C:
|
||||
logFn("%s: resending vp8 config fps=%d batch=%d trackCount=%d, no ack yet",
|
||||
logPrefix, fps, batch, trackCount)
|
||||
tun.SendData(EncodeVP8Config(fps, batch, trackCount))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func EncodeFrame(connID uint32, msgType byte, payload []byte) []byte {
|
||||
buf := make([]byte, 4+5+len(payload))
|
||||
binary.BigEndian.PutUint32(buf[0:4], uint32(5+len(payload)))
|
||||
|
||||
Reference in new issue
Block a user