From e02b12bb6884ef5553dd70fc2756ffbd234c3a64 Mon Sep 17 00:00:00 2001 From: macbookpro Date: Sat, 8 Dec 2018 16:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=8B=89=E4=B8=8D=E5=88=B0=E6=B5=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtsp/rtsp-client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtsp/rtsp-client.go b/rtsp/rtsp-client.go index 7300136e..3f5acd3a 100644 --- a/rtsp/rtsp-client.go +++ b/rtsp/rtsp-client.go @@ -151,6 +151,7 @@ func (client *RTSPClient) Start(timeout time.Duration) error { } client.Sdp = sess client.SDPRaw = resp.Body + Session := "" for _, media := range sess.Media { switch media.Type { case "video": @@ -168,6 +169,7 @@ func (client *RTSPClient) Start(timeout time.Duration) error { if err != nil { return err } + Session = resp.Header["Session"] case "audio": client.AControl = media.Attributes.Get("control") client.VCodec = media.Formats[0].Name @@ -183,9 +185,13 @@ func (client *RTSPClient) Start(timeout time.Duration) error { if err != nil { return err } + Session = resp.Header["Session"] } } headers = make(map[string]string) + if Session != "" { + headers["Session"] = Session + } resp, err = client.Request("PLAY", headers) if err != nil { return err