From ad9a22c0b2f1b213fa904ebd0c23c6fb72f5fa8f Mon Sep 17 00:00:00 2001 From: mask-pp Date: Mon, 3 Aug 2020 19:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=BA=E5=BA=8F=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84rtspclient?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=BC=80=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 192cb718..45ecd2d3 100644 --- a/main.go +++ b/main.go @@ -136,6 +136,9 @@ func (p *program) Start(s service.Service) (err error) { } for i := len(streams) - 1; i > -1; i-- { v := streams[i] + if rtsp.GetServer().GetPusher(v.CustomPath) != nil { + continue + } agent := fmt.Sprintf("EasyDarwinGo/%s", routers.BuildVersion) if routers.BuildDateTime != "" { agent = fmt.Sprintf("%s(%s)", agent, routers.BuildDateTime) @@ -146,15 +149,12 @@ func (p *program) Start(s service.Service) (err error) { } client.CustomPath = v.CustomPath - pusher := rtsp.NewClientPusher(client) - if rtsp.GetServer().GetPusher(pusher.Path()) != nil { - continue - } err = client.Start(time.Duration(v.IdleTimeout) * time.Second) if err != nil { log.Printf("Pull stream err :%v", err) continue } + pusher := rtsp.NewClientPusher(client) rtsp.GetServer().AddPusher(pusher) //streams = streams[0:i] //streams = append(streams[:i], streams[i+1:]...)