增加重连时的判断

This commit is contained in:
langhuihui
2020-07-09 22:04:00 +08:00
parent cb733b368f
commit 67da93d8e2

View File

@@ -277,8 +277,8 @@ func (client *RTSP) requestStream() (err error) {
func (client *RTSP) startStream() {
//startTime := time.Now()
//loggerTime := time.Now().Add(-10 * time.Second)
if config.Reconnect {
defer func() {
defer func() {
if client.Err() == nil && config.Reconnect {
Printf("reconnecting:", client.URL)
if err := client.requestStream(); err != nil {
Println(err)
@@ -286,10 +286,10 @@ func (client *RTSP) startStream() {
return
}
go client.startStream()
}()
} else {
defer client.Stop()
}
} else {
client.Stop()
}
}()
for client.Err() == nil {
//if client.OptionIntervalMillis > 0 {
// if time.Since(startTime) > time.Duration(client.OptionIntervalMillis)*time.Millisecond {