feat: add sendoptions config to avoid send options

This commit is contained in:
langhuihui
2023-10-25 10:22:29 +08:00
parent 9ac21a130e
commit 3e4dcdf649
2 changed files with 9 additions and 4 deletions

View File

@@ -60,9 +60,11 @@ func (p *RTSPPuller) Connect() error {
func (p *RTSPPuller) Pull() (err error) { func (p *RTSPPuller) Pull() (err error) {
u, _ := url.Parse(p.RemoteURL) u, _ := url.Parse(p.RemoteURL)
var res *base.Response var res *base.Response
if res, err = p.Options(u); err != nil { if rtspConfig.SendOptions {
p.Error("Options", zap.Error(err)) if res, err = p.Options(u); err != nil {
return p.Error("Options", zap.Error(err))
return
}
} }
p.Debug("Options", zap.Any("res", res)) p.Debug("Options", zap.Any("res", res))
// find published tracks // find published tracks
@@ -126,7 +128,9 @@ func (p *RTSPPusher) Connect() error {
return err return err
} }
p.SetIO(p) p.SetIO(p)
_, err = p.Client.Options(u) if rtspConfig.SendOptions {
_, err = p.Client.Options(u)
}
return err return err
} }

View File

@@ -21,6 +21,7 @@ type RTSPConfig struct {
UDPAddr string `default:":8000"` UDPAddr string `default:":8000"`
RTCPAddr string `default:":8001"` RTCPAddr string `default:":8001"`
WriteBufferCount int `default:"2048"` WriteBufferCount int `default:"2048"`
SendOptions bool `default:"true"`
sync.Map sync.Map
server *gortsplib.Server server *gortsplib.Server
} }