Skip to content

Commit

Permalink
Add timeout query param to RTSP incoming source #1118
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed May 24, 2024
1 parent b3e9ed2 commit d9d2bdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/rtsp/rtsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion pkg/rtsp/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d9d2bdf

Please sign in to comment.