single port mode connectivity improvements, ICE v2.1.6
This commit is contained in:
@@ -67,8 +67,7 @@ func NewConfig(confString string) (*Config, error) {
|
||||
conf := &Config{
|
||||
Port: 7880,
|
||||
RTC: RTCConfig{
|
||||
UseExternalIP: true,
|
||||
|
||||
UseExternalIP: true,
|
||||
ICEPortRangeStart: 9000,
|
||||
ICEPortRangeEnd: 11000,
|
||||
StunServers: []string{
|
||||
|
||||
+4
-3
@@ -61,12 +61,13 @@ func NewWebRTCConfig(conf *config.RTCConfig, externalIP string) (*WebRTCConfig,
|
||||
networkTypes := make([]webrtc.NetworkType, 0, 4)
|
||||
if !conf.ForceTCP {
|
||||
networkTypes = append(networkTypes,
|
||||
webrtc.NetworkTypeUDP4)
|
||||
webrtc.NetworkTypeUDP4,
|
||||
)
|
||||
}
|
||||
|
||||
var udpMux *ice.UDPMuxDefault
|
||||
if conf.UDPPort != 0 {
|
||||
conn, err := net.ListenUDP("udp", &net.UDPAddr{
|
||||
conn, err := net.ListenUDP("udp4", &net.UDPAddr{
|
||||
Port: int(conf.UDPPort),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -88,7 +89,7 @@ func NewWebRTCConfig(conf *config.RTCConfig, externalIP string) (*WebRTCConfig,
|
||||
networkTypes = append(networkTypes,
|
||||
webrtc.NetworkTypeTCP4,
|
||||
)
|
||||
tcpListener, err := net.ListenTCP("tcp", &net.TCPAddr{
|
||||
tcpListener, err := net.ListenTCP("tcp4", &net.TCPAddr{
|
||||
Port: int(conf.TCPPort),
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -547,10 +547,12 @@ func (p *ParticipantImpl) sendIceCandidate(c *webrtc.ICECandidate, target liveki
|
||||
ci := c.ToJSON()
|
||||
|
||||
// write candidate
|
||||
//logger.Debugw("sending ice candidates")
|
||||
logger.Debugw("sending ice candidates",
|
||||
"participant", p.Identity(),
|
||||
"candidate", c.String())
|
||||
trickle := ToProtoTrickle(ci)
|
||||
trickle.Target = target
|
||||
p.writeMessage(&livekit.SignalResponse{
|
||||
_ = p.writeMessage(&livekit.SignalResponse{
|
||||
Message: &livekit.SignalResponse_Trickle{
|
||||
Trickle: trickle,
|
||||
},
|
||||
|
||||
@@ -125,7 +125,7 @@ func (s *LivekitServer) Start() error {
|
||||
if s.config.RTC.TCPPort != 0 {
|
||||
values = append(values, "rtc.tcp_port", s.config.RTC.TCPPort)
|
||||
}
|
||||
if s.config.RTC.UDPPort != 0 {
|
||||
if !s.config.RTC.ForceTCP && s.config.RTC.UDPPort != 0 {
|
||||
values = append(values, "rtc.udp_port", s.config.RTC.UDPPort)
|
||||
} else {
|
||||
values = append(values,
|
||||
|
||||
Reference in New Issue
Block a user