From 857fbccdea3fac7c0e7815e52d02549eb0b1352a Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sun, 19 Jul 2020 18:35:53 +0200 Subject: [PATCH] remove streamDeadAfter --- conf.go | 4 ---- rtsp-simple-server.yml | 2 -- server-client.go | 4 ++-- source.go | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/conf.go b/conf.go index d279bfe8..c127965d 100644 --- a/conf.go +++ b/conf.go @@ -35,7 +35,6 @@ type conf struct { RunOnConnect string `yaml:"runOnConnect"` ReadTimeout time.Duration `yaml:"readTimeout"` WriteTimeout time.Duration `yaml:"writeTimeout"` - StreamDeadAfter time.Duration `yaml:"streamDeadAfter"` AuthMethods []string `yaml:"authMethods"` authMethodsParsed []gortsplib.AuthMethod Pprof bool `yaml:"pprof"` @@ -122,9 +121,6 @@ func loadConf(fpath string, stdin io.Reader) (*conf, error) { if conf.WriteTimeout == 0 { conf.WriteTimeout = 5 * time.Second } - if conf.StreamDeadAfter == 0 { - conf.StreamDeadAfter = 15 * time.Second - } if len(conf.AuthMethods) == 0 { conf.AuthMethods = []string{"basic", "digest"} diff --git a/rtsp-simple-server.yml b/rtsp-simple-server.yml index 7b6f9aab..2e388713 100644 --- a/rtsp-simple-server.yml +++ b/rtsp-simple-server.yml @@ -14,8 +14,6 @@ runOnConnect: readTimeout: 5s # timeout of write operations writeTimeout: 5s -# time after which a stream is considered dead -streamDeadAfter: 15s # supported authentication methods authMethods: [basic, digest] # enable pprof on port 9999 to monitor performance diff --git a/server-client.go b/server-client.go index c46a7c87..deed5a5f 100644 --- a/server-client.go +++ b/server-client.go @@ -966,7 +966,7 @@ func (c *serverClient) runRecord(path string) { case <-checkStreamTicker.C: for trackId := range c.streamTracks { - if time.Since(c.rtcpReceivers[trackId].LastFrameTime()) >= c.p.conf.StreamDeadAfter { + if time.Since(c.rtcpReceivers[trackId].LastFrameTime()) >= c.p.conf.ReadTimeout { c.log("ERR: stream is dead") c.conn.NetConn().Close() <-readDone @@ -1021,7 +1021,7 @@ func (c *serverClient) runRecord(path string) { case <-checkStreamTicker.C: for trackId := range c.streamTracks { - if time.Since(c.rtcpReceivers[trackId].LastFrameTime()) >= c.p.conf.StreamDeadAfter { + if time.Since(c.rtcpReceivers[trackId].LastFrameTime()) >= c.p.conf.ReadTimeout { c.log("ERR: stream is dead") c.conn.NetConn().Close() <-readDone diff --git a/source.go b/source.go index 5f104654..9a5717b5 100644 --- a/source.go +++ b/source.go @@ -276,7 +276,7 @@ outer: case <-checkStreamTicker.C: for trackId := range s.tracks { - if time.Since(s.rtcpReceivers[trackId].LastFrameTime()) >= s.p.conf.StreamDeadAfter { + if time.Since(s.rtcpReceivers[trackId].LastFrameTime()) >= s.p.conf.ReadTimeout { s.log("ERR: stream is dead") ret = true break outer