rtsp: conn.Close() before retry dialing with backchannel=false

This commit is contained in:
Yousong Zhou
2023-04-07 16:46:20 +08:00
parent 9f3d5e7460
commit af79e6054b
+4 -2
View File
@@ -5,14 +5,15 @@ import (
"crypto/tls"
"errors"
"fmt"
"github.com/AlexxIT/go2rtc/pkg/core"
"github.com/AlexxIT/go2rtc/pkg/tcp"
"net"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/AlexxIT/go2rtc/pkg/core"
"github.com/AlexxIT/go2rtc/pkg/tcp"
)
func NewClient(uri string) *Conn {
@@ -309,6 +310,7 @@ func (c *Conn) SetupMedia(media *core.Media, first bool) (byte, error) {
// some Dahua/Amcrest cameras fail here because two simultaneous
// backchannel connections
if c.Backchannel {
c.Close()
c.Backchannel = false
if err := c.Dial(); err != nil {
return 0, err