mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-10-05 23:06:55 +08:00
👌 IMPROVE:增加对端口监听的判断
This commit is contained in:
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.18
|
||||
require (
|
||||
github.com/pion/interceptor v0.1.11
|
||||
github.com/pion/rtcp v1.2.9
|
||||
github.com/pion/webrtc/v3 v3.1.43
|
||||
github.com/pion/webrtc/v3 v3.1.44
|
||||
m7s.live/engine/v4 v4.6.8
|
||||
)
|
||||
|
||||
|
2
go.sum
2
go.sum
@@ -101,6 +101,8 @@ github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
|
||||
github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
|
||||
github.com/pion/webrtc/v3 v3.1.43 h1:YT3ZTO94UT4kSBvZnRAH82+0jJPUruiKr9CEstdlQzk=
|
||||
github.com/pion/webrtc/v3 v3.1.43/go.mod h1:G/J8k0+grVsjC/rjCZ24AKoCCxcFFODgh7zThNZGs0M=
|
||||
github.com/pion/webrtc/v3 v3.1.44 h1:uY11C9cOupY36bS3Q16NI298c/XKhl5S9EMCo/TxH3Y=
|
||||
github.com/pion/webrtc/v3 v3.1.44/go.mod h1:G/J8k0+grVsjC/rjCZ24AKoCCxcFFODgh7zThNZGs0M=
|
||||
github.com/pixelbender/go-sdp v1.1.0/go.mod h1:6IBlz9+BrUHoFTea7gcp4S54khtOhjCW/nVDLhmZBAs=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
11
main.go
11
main.go
@@ -2,12 +2,14 @@ package webrtc
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"m7s.live/engine/v4"
|
||||
"net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"m7s.live/engine/v4"
|
||||
|
||||
"github.com/pion/interceptor"
|
||||
|
||||
. "github.com/pion/webrtc/v3"
|
||||
@@ -77,11 +79,14 @@ func (conf *WebRTCConfig) OnEvent(event any) {
|
||||
// 是否多路复用UDP端口
|
||||
if conf.InvitePortFixed {
|
||||
// 创建共享WEBRTC端口 默认9000
|
||||
udpListener, _ := net.ListenUDP("udp", &net.UDPAddr{
|
||||
udpListener, err := net.ListenUDP("udp", &net.UDPAddr{
|
||||
IP: net.IP{0, 0, 0, 0},
|
||||
Port: conf.IceUdpMux,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
plugin.Fatal("webrtc listener udp", zap.Error(err))
|
||||
}
|
||||
plugin.Info("webrtc start listen", zap.Int("port", conf.IceUdpMux))
|
||||
conf.s.SetICEUDPMux(NewICEUDPMux(nil, udpListener))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user