mirror of
https://github.com/aler9/gortsplib
synced 2025-12-24 13:38:08 +08:00
server: fix timeout when reading with Media Foundation (bluenviron/mediamtx#5090) (#932)
This commit is contained in:
@@ -882,9 +882,14 @@ func (ss *ServerSession) runInner() error {
|
||||
res.Header = make(base.Header)
|
||||
}
|
||||
|
||||
// Media Foundation-based software, like Windows Media Player,
|
||||
// send keepalives at an interval equal the timeout value.
|
||||
// prevent timeouts by subtracting 5 seconds from the value.
|
||||
timeout := max(int(ss.s.IdleTimeout/time.Second)-5, 1)
|
||||
|
||||
res.Header["Session"] = headers.Session{
|
||||
Session: ss.secretID,
|
||||
Timeout: ptrOf(uint(ss.s.IdleTimeout / time.Second)),
|
||||
Timeout: ptrOf(uint(timeout)),
|
||||
}.Marshal()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user