From 6cef5faf27dc3b14cef74d95c220bccae90fe72e Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Mon, 17 Apr 2023 15:12:03 +0300 Subject: [PATCH] Add timeout value to RTSP SETUP response #289 --- pkg/rtsp/conn.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/rtsp/conn.go b/pkg/rtsp/conn.go index 142bc77d..69e67faa 100644 --- a/pkg/rtsp/conn.go +++ b/pkg/rtsp/conn.go @@ -72,9 +72,9 @@ func (s State) String() string { return "CONN" case StateSetup: - return "SETUP" + return MethodSetup case StatePlay: - return "PLAY" + return MethodPlay } return strconv.Itoa(int(s)) } @@ -312,7 +312,11 @@ func (c *Conn) WriteResponse(res *tcp.Response) error { } if c.session != "" { - res.Header.Set("Session", c.session) + if res.Request != nil && res.Request.Method == MethodSetup { + res.Header.Set("Session", c.session+";timeout=60") + } else { + res.Header.Set("Session", c.session) + } } if res.Body != nil {