From d9d2bdff44ab777ab8eb353196adf49594560d30 Mon Sep 17 00:00:00 2001 From: Alex X Date: Fri, 24 May 2024 16:26:06 +0300 Subject: [PATCH] Add timeout query param to RTSP incoming source #1118 --- internal/rtsp/rtsp.go | 5 +++++ pkg/rtsp/conn.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/rtsp/rtsp.go b/internal/rtsp/rtsp.go index c5e21678..230bdece 100644 --- a/internal/rtsp/rtsp.go +++ b/internal/rtsp/rtsp.go @@ -210,6 +210,11 @@ func tcpHandler(conn *rtsp.Conn) { return } + query := conn.URL.Query() + if s := query.Get("timeout"); s != "" { + conn.Timeout = core.Atoi(s) + } + log.Debug().Str("stream", name).Msg("[rtsp] new producer") stream.AddProducer(conn) diff --git a/pkg/rtsp/conn.go b/pkg/rtsp/conn.go index e801b7e4..91465f2c 100644 --- a/pkg/rtsp/conn.go +++ b/pkg/rtsp/conn.go @@ -124,7 +124,11 @@ func (c *Conn) Handle() (err error) { case core.ModePassiveProducer: // polling frames from remote RTSP Client (ex FFmpeg) - timeout = time.Second * 15 + if c.Timeout == 0 { + timeout = time.Second * 15 + } else { + timeout = time.Second * time.Duration(c.Timeout) + } case core.ModePassiveConsumer: // pushing frames to remote RTSP Client (ex VLC)