Rewrite webrtc listen logic #1890 #1892

This commit is contained in:
Alex X
2025-12-26 22:56:39 +03:00
parent 3fd1fe2622
commit 9b618f45d0
2 changed files with 132 additions and 39 deletions
+9 -1
View File
@@ -57,6 +57,15 @@ func Init() {
}
}
webrtc.OnNewListener = func(ln any) {
switch ln := ln.(type) {
case *net.TCPListener:
log.Info().Stringer("addr", ln.Addr()).Msg("[webrtc] listen tcp")
case *net.UDPConn:
log.Info().Stringer("addr", ln.LocalAddr()).Msg("[webrtc] listen udp")
}
}
var err error
// create pionAPI with custom codecs list and custom network settings
@@ -70,7 +79,6 @@ func Init() {
clientAPI = serverAPI
if address != "" {
log.Info().Str("addr", cfg.Mod.Listen).Msg("[webrtc] listen")
clientAPI, _ = webrtc.NewAPI()
}