mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-24 20:11:56 -08:00
rewrite client to use the new gortsplib ServerConn
This commit is contained in:
parent
692b236c6c
commit
f9e6cdcb7b
6 changed files with 363 additions and 685 deletions
2
go.mod
2
go.mod
|
|
@ -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-20201208105438-07aefbcd5d11
|
||||
github.com/aler9/gortsplib v0.0.0-20201212222949-4c942d33fed8
|
||||
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
4
go.sum
|
|
@ -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-20201208105438-07aefbcd5d11 h1:as97tV7XyNJurmD1e3iT0AcgxeIwRa+nwMm10gi0vO0=
|
||||
github.com/aler9/gortsplib v0.0.0-20201208105438-07aefbcd5d11/go.mod h1:8P09VjpiPJFyfkVosyF5/TY82jNwkMN165NS/7sc32I=
|
||||
github.com/aler9/gortsplib v0.0.0-20201212222949-4c942d33fed8 h1:nDEZtoFBPDPgu9wxujoTEmMXFNTg+d0ATYKSgGHtsgE=
|
||||
github.com/aler9/gortsplib v0.0.0-20201212222949-4c942d33fed8/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=
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -37,7 +37,7 @@ func New(port int,
|
|||
ReadBufferCount: 1,
|
||||
}
|
||||
|
||||
srv, err := conf.Serve(":"+strconv.FormatInt(int64(port), 10), nil)
|
||||
srv, err := conf.Serve(":" + strconv.FormatInt(int64(port), 10))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ func (s *Source) runInner() bool {
|
|||
s.parent.OnSourceSetReady(tracks)
|
||||
defer s.parent.OnSourceSetNotReady()
|
||||
|
||||
readerDone := conn.OnFrame(func(trackID int, streamType gortsplib.StreamType, content []byte) {
|
||||
done := conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, content []byte) {
|
||||
s.parent.OnFrame(trackID, streamType, content)
|
||||
})
|
||||
|
||||
|
|
@ -157,10 +157,10 @@ func (s *Source) runInner() bool {
|
|||
select {
|
||||
case <-s.terminate:
|
||||
conn.Close()
|
||||
<-readerDone
|
||||
<-done
|
||||
return false
|
||||
|
||||
case err := <-readerDone:
|
||||
case err := <-done:
|
||||
conn.Close()
|
||||
s.log(logger.Info, "ERR: %s", err)
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ paths:
|
|||
|
||||
# if the source is an RTSP url, this is the protocol that will be used to
|
||||
# pull the stream. available options are "automatic", "udp", "tcp".
|
||||
# the tcp protocol can help to overcome the error "no packets received recently".
|
||||
# the tcp protocol can help to overcome the error "no UDP packets received recently".
|
||||
sourceProtocol: automatic
|
||||
|
||||
# if the source is an RTSP or RTMP url, it will be pulled only when at least
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue