Browse Source

update gortsplib (#1671)

pull/1672/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
efb6060b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      go.mod
  2. 4
      go.sum
  3. 2
      internal/core/core_test.go
  4. 12
      internal/core/rtsp_server.go
  5. 11
      internal/core/rtsp_session.go
  6. 10
      internal/core/rtsp_source.go

2
go.mod

@ -7,7 +7,7 @@ require ( @@ -7,7 +7,7 @@ require (
github.com/alecthomas/kong v0.7.1
github.com/asticode/go-astits v1.11.0
github.com/bluenviron/gohlslib v0.1.1
github.com/bluenviron/gortsplib/v3 v3.0.0
github.com/bluenviron/gortsplib/v3 v3.1.0
github.com/bluenviron/mediacommon v0.2.0
github.com/fsnotify/fsnotify v1.6.0
github.com/gin-gonic/gin v1.9.0

4
go.sum

@ -12,8 +12,8 @@ github.com/asticode/go-astits v1.11.0 h1:GTHUXht0ZXAJXsVbsLIcyfHr1Bchi4QQwMARw2Z @@ -12,8 +12,8 @@ github.com/asticode/go-astits v1.11.0 h1:GTHUXht0ZXAJXsVbsLIcyfHr1Bchi4QQwMARw2Z
github.com/asticode/go-astits v1.11.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
github.com/bluenviron/gohlslib v0.1.1 h1:rUwMsILN8Wkxx9NxZYKx3CdDZIIuMpfVNe7IXLxe26A=
github.com/bluenviron/gohlslib v0.1.1/go.mod h1:jPRjSDyELabTOcVXkI/H3U3/sCMQZzpBL+8+GAlquPE=
github.com/bluenviron/gortsplib/v3 v3.0.0 h1:1H1+Z/U5VDgn30XhUO/BjJUbBoVxg/miMwSPs7I3BxI=
github.com/bluenviron/gortsplib/v3 v3.0.0/go.mod h1:hqJ4DffxUbzVj+PM9ilPwr0jlBMwqqoCe58eoLCHG+w=
github.com/bluenviron/gortsplib/v3 v3.1.0 h1:GSzIHzYzxnvrFlnI7hmV+sML2W45/nBBH9DqcZDOIB4=
github.com/bluenviron/gortsplib/v3 v3.1.0/go.mod h1:gAN1zD0tywu09WKNdHfXWU17VBJUVchXnhc4s+2H9Sc=
github.com/bluenviron/mediacommon v0.2.0 h1:XEuIr8FA5bfzjsQhrITd6ILgN9JCl0e0Cu8IVFEp5Hk=
github.com/bluenviron/mediacommon v0.2.0/go.mod h1:t0dqPsWUTchyvib0MhixIwXEgvDX4V9G+I0GzWLQRb8=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=

2
internal/core/core_test.go

@ -133,7 +133,7 @@ func TestCorePathAutoDeletion(t *testing.T) { @@ -133,7 +133,7 @@ func TestCorePathAutoDeletion(t *testing.T) {
require.NoError(t, err)
require.Equal(t, base.StatusNotFound, res.StatusCode)
} else {
u, err := url.Parse("rtsp://localhost:8554/mypath/mediaUUID=xxx")
u, err := url.Parse("rtsp://localhost:8554/mypath/trackID=0")
require.NoError(t, err)
byts, _ := base.Request{

12
internal/core/rtsp_server.go

@ -351,10 +351,16 @@ func (s *rtspServer) OnPause(ctx *gortsplib.ServerHandlerOnPauseCtx) (*base.Resp @@ -351,10 +351,16 @@ func (s *rtspServer) OnPause(ctx *gortsplib.ServerHandlerOnPauseCtx) (*base.Resp
return se.onPause(ctx)
}
// OnDecodeError implements gortsplib.ServerHandlerOnWarning.
func (s *rtspServer) OnWarning(ctx *gortsplib.ServerHandlerOnWarningCtx) {
// OnPacketLost implements gortsplib.ServerHandlerOnDecodeError.
func (s *rtspServer) OnPacketLost(ctx *gortsplib.ServerHandlerOnPacketLostCtx) {
se := ctx.Session.UserData().(*rtspSession)
se.onWarning(ctx)
se.onPacketLost(ctx)
}
// OnDecodeError implements gortsplib.ServerHandlerOnDecodeError.
func (s *rtspServer) OnDecodeError(ctx *gortsplib.ServerHandlerOnDecodeErrorCtx) {
se := ctx.Session.UserData().(*rtspSession)
se.onDecodeError(ctx)
}
// apiConnsList is called by api and metrics.

11
internal/core/rtsp_session.go

@ -470,7 +470,12 @@ func (s *rtspSession) apiSourceDescribe() interface{} { @@ -470,7 +470,12 @@ func (s *rtspSession) apiSourceDescribe() interface{} {
}{typ, s.uuid.String()}
}
// onWarning is called by rtspServer.
func (s *rtspSession) onWarning(ctx *gortsplib.ServerHandlerOnWarningCtx) {
s.log(logger.Warn, "%v", ctx.Error)
// onPacketLost is called by rtspServer.
func (s *rtspSession) onPacketLost(ctx *gortsplib.ServerHandlerOnPacketLostCtx) {
s.log(logger.Warn, ctx.Error.Error())
}
// onDecodeError is called by rtspServer.
func (s *rtspSession) onDecodeError(ctx *gortsplib.ServerHandlerOnDecodeErrorCtx) {
s.log(logger.Warn, ctx.Error.Error())
}

10
internal/core/rtsp_source.go

@ -88,8 +88,14 @@ func (s *rtspSource) run(ctx context.Context, cnf *conf.PathConf, reloadConf cha @@ -88,8 +88,14 @@ func (s *rtspSource) run(ctx context.Context, cnf *conf.PathConf, reloadConf cha
OnResponse: func(res *base.Response) {
s.Log(logger.Debug, "s->c %v", res)
},
Log: func(level gortsplib.LogLevel, format string, args ...interface{}) {
s.Log(logger.Warn, format, args...)
OnTransportSwitch: func(err error) {
s.Log(logger.Warn, err.Error())
},
OnPacketLost: func(err error) {
s.Log(logger.Warn, err.Error())
},
OnDecodeError: func(err error) {
s.Log(logger.Warn, err.Error())
},
}

Loading…
Cancel
Save