server: fix timeout when reading with Media Foundation (bluenviron/mediamtx#5090) (#932)

This commit is contained in:
Alessandro Ros
2025-11-02 17:03:44 +01:00
committed by GitHub
parent 69481ce0bd
commit 1214bdc17e
3 changed files with 11 additions and 3 deletions

View File

@@ -1229,7 +1229,10 @@ func (c *Client) do(req *base.Request, skipResponse bool) (*base.Response, error
c.session = sx.Session
if sx.Timeout != nil && *sx.Timeout > 0 {
c.keepAlivePeriod = time.Duration(*sx.Timeout) * time.Second * 8 / 10
c.keepAlivePeriod = max(
(time.Duration(*sx.Timeout)*time.Second)-5*time.Second,
1*time.Second,
)
}
}