Browse Source

rtsp, rtmp: fix ignored errors

pull/543/head
aler9 4 years ago
parent
commit
801ef44f54
  1. 25
      internal/core/rtmp_source.go
  2. 2
      internal/core/rtsp_source.go

25
internal/core/rtmp_source.go

@ -78,22 +78,17 @@ func (s *rtmpSource) log(level logger.Level, format string, args ...interface{}) @@ -78,22 +78,17 @@ func (s *rtmpSource) log(level logger.Level, format string, args ...interface{})
func (s *rtmpSource) run() {
defer s.wg.Done()
outer:
for {
ok := func() bool {
ok := s.runInner()
if !ok {
return false
}
select {
case <-time.After(rtmpSourceRetryPause):
return true
case <-s.ctx.Done():
return false
}
}()
ok := s.runInner()
if !ok {
break
break outer
}
select {
case <-time.After(rtmpSourceRetryPause):
case <-s.ctx.Done():
break outer
}
}
@ -158,7 +153,7 @@ func (s *rtmpSource) runInner() bool { @@ -158,7 +153,7 @@ func (s *rtmpSource) runInner() bool {
Tracks: tracks,
})
if res.Err != nil {
return err
return res.Err
}
s.log(logger.Info, "ready")

2
internal/core/rtsp_source.go

@ -177,7 +177,7 @@ func (s *rtspSource) runInner() bool { @@ -177,7 +177,7 @@ func (s *rtspSource) runInner() bool {
Tracks: conn.Tracks(),
})
if res.Err != nil {
s.log(logger.Info, "ERR: %s", err)
s.log(logger.Info, "ERR: %s", res.Err)
return true
}

Loading…
Cancel
Save