Fix WebRTC mux issues (#17)

* use NewMultiUDPMuxFromPort.

* tcp mux add write buffer size.
This commit is contained in:
Miroslav Šedivý 2022-12-13 11:35:03 +01:00 committed by GitHub
parent 919a554a9e
commit 6b39e8e0e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,21 +109,24 @@ func (manager *WebRTCManagerCtx) Start() {
manager.logger.Panic().Err(err).Msg("unable to setup ice TCP mux") manager.logger.Panic().Err(err).Msg("unable to setup ice TCP mux")
} }
manager.tcpMux = webrtc.NewICETCPMux(logger.NewLogger("ice-tcp"), tcpListener, 32) manager.tcpMux = ice.NewTCPMuxDefault(ice.TCPMuxParams{
Listener: tcpListener,
Logger: logger.NewLogger("ice-tcp"),
ReadBufferSize: 32, // receiving channel size
WriteBufferSize: 4 * 1024 * 1024, // write buffer size, 4MB
})
} }
// add UDP Mux listener // add UDP Mux listener
if manager.config.UDPMux > 0 { if manager.config.UDPMux > 0 {
udpListener, err := net.ListenUDP("udp", &net.UDPAddr{ var err error
IP: net.IP{0, 0, 0, 0}, manager.udpMux, err = ice.NewMultiUDPMuxFromPort(manager.config.UDPMux,
Port: manager.config.UDPMux, ice.UDPMuxFromPortWithLogger(logger.NewLogger("ice-udp")),
}) )
if err != nil { if err != nil {
manager.logger.Panic().Err(err).Msg("unable to setup ice UDP mux") manager.logger.Panic().Err(err).Msg("unable to setup ice UDP mux")
} }
manager.udpMux = webrtc.NewICEUDPMux(logger.NewLogger("ice-udp"), udpListener)
} }
manager.logger.Info(). manager.logger.Info().