update gortsplib

This commit is contained in:
aler9 2021-03-06 09:54:10 +01:00
parent 6a61202459
commit ba6c27a49e
3 changed files with 14 additions and 35 deletions

2
go.mod
View file

@ -5,7 +5,7 @@ go 1.15
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/aler9/gortsplib v0.0.0-20210305211824-964331cacdb3
github.com/aler9/gortsplib v0.0.0-20210306084624-260af6e04194
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51

4
go.sum
View file

@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aler9/gortsplib v0.0.0-20210305211824-964331cacdb3 h1:rvuE+K7Cfh9kOwspnVek4+UuB0Ix4d0xWhDrsGSCvzk=
github.com/aler9/gortsplib v0.0.0-20210305211824-964331cacdb3/go.mod h1:8P09VjpiPJFyfkVosyF5/TY82jNwkMN165NS/7sc32I=
github.com/aler9/gortsplib v0.0.0-20210306084624-260af6e04194 h1:LMhKYN1HfEvVPV5YL6ZLR6eQgXbz2H4bdb1eQK7lrQA=
github.com/aler9/gortsplib v0.0.0-20210306084624-260af6e04194/go.mod h1:8P09VjpiPJFyfkVosyF5/TY82jNwkMN165NS/7sc32I=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

View file

@ -19,9 +19,7 @@ type Parent interface {
type Server struct {
parent Parent
srv *gortsplib.Server
udpRTPListener *gortsplib.ServerUDPListener
udpRTCPListener *gortsplib.ServerUDPListener
srv *gortsplib.Server
// out
accept chan *gortsplib.ServerConn
@ -50,20 +48,8 @@ func New(
}
if useUDP {
address := listenIP + ":" + strconv.FormatInt(int64(rtpPort), 10)
var err error
conf.UDPRTPListener, err = gortsplib.NewServerUDPListener(address)
if err != nil {
return nil, err
}
parent.Log(logger.Info, "[RTSP/UDP/RTP listener] opened on %s", address)
address = listenIP + ":" + strconv.FormatInt(int64(rtcpPort), 10)
conf.UDPRTCPListener, err = gortsplib.NewServerUDPListener(address)
if err != nil {
return nil, err
}
parent.Log(logger.Info, "[RTSP/UDP/RTCP listener] opened on %s", address)
conf.UDPRTPAddress = listenIP + ":" + strconv.FormatInt(int64(rtpPort), 10)
conf.UDPRTCPAddress = listenIP + ":" + strconv.FormatInt(int64(rtcpPort), 10)
}
if useTLS {
@ -82,14 +68,16 @@ func New(
}
s := &Server{
parent: parent,
srv: srv,
udpRTPListener: conf.UDPRTPListener,
udpRTCPListener: conf.UDPRTCPListener,
accept: make(chan *gortsplib.ServerConn),
done: make(chan struct{}),
parent: parent,
srv: srv,
accept: make(chan *gortsplib.ServerConn),
done: make(chan struct{}),
}
parent.Log(logger.Info, "[RTSP/UDP/RTP listener] opened on %s", conf.UDPRTPAddress)
parent.Log(logger.Info, "[RTSP/UDP/RTCP listener] opened on %s", conf.UDPRTCPAddress)
label := func() string {
if conf.TLSConfig != nil {
return "RTSP/TLS"
@ -112,15 +100,6 @@ func (s *Server) Close() {
}()
s.srv.Close()
if s.udpRTPListener != nil {
s.udpRTPListener.Close()
}
if s.udpRTCPListener != nil {
s.udpRTCPListener.Close()
}
<-s.done
}