From e43b1e4ab6c9bd454061d050847bb785546a064b Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Fri, 17 Feb 2023 09:20:46 +0300 Subject: [PATCH] Restore Announce method for RTSP --- pkg/rtsp/client.go | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/pkg/rtsp/client.go b/pkg/rtsp/client.go index ba7a48b6..449dbf90 100644 --- a/pkg/rtsp/client.go +++ b/pkg/rtsp/client.go @@ -319,24 +319,26 @@ func (c *Conn) Describe() error { return nil } -//func (c *Conn) Announce() (err error) { -// req := &tcp.Request{ -// Method: MethodAnnounce, -// URL: c.URL, -// Header: map[string][]string{ -// "Content-Type": {"application/sdp"}, -// }, -// } -// -// //req.Body, err = c.sdp.Marshal() -// if err != nil { -// return -// } -// -// _, err = c.Do(req) -// -// return -//} +func (c *Conn) Announce() (err error) { + req := &tcp.Request{ + Method: MethodAnnounce, + URL: c.URL, + Header: map[string][]string{ + "Content-Type": {"application/sdp"}, + }, + } + + req.Body, err = streamer.MarshalSDP(c.SessionName, c.Medias) + if err != nil { + return err + } + + res, err := c.Do(req) + + _ = res + + return +} func (c *Conn) Setup() error { for _, media := range c.Medias {