From 3e4dcdf649c8cf9d42b7bfa93ce5282b723d4e00 Mon Sep 17 00:00:00 2001 From: langhuihui <178529795@qq.com> Date: Wed, 25 Oct 2023 10:22:29 +0800 Subject: [PATCH] feat: add sendoptions config to avoid send options --- client.go | 12 ++++++++---- main.go | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index 381b795..6152015 100644 --- a/client.go +++ b/client.go @@ -60,9 +60,11 @@ func (p *RTSPPuller) Connect() error { func (p *RTSPPuller) Pull() (err error) { u, _ := url.Parse(p.RemoteURL) var res *base.Response - if res, err = p.Options(u); err != nil { - p.Error("Options", zap.Error(err)) - return + if rtspConfig.SendOptions { + if res, err = p.Options(u); err != nil { + p.Error("Options", zap.Error(err)) + return + } } p.Debug("Options", zap.Any("res", res)) // find published tracks @@ -126,7 +128,9 @@ func (p *RTSPPusher) Connect() error { return err } p.SetIO(p) - _, err = p.Client.Options(u) + if rtspConfig.SendOptions { + _, err = p.Client.Options(u) + } return err } diff --git a/main.go b/main.go index b007ce7..f9dcf3a 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,7 @@ type RTSPConfig struct { UDPAddr string `default:":8000"` RTCPAddr string `default:":8001"` WriteBufferCount int `default:"2048"` + SendOptions bool `default:"true"` sync.Map server *gortsplib.Server }