mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-17 05:00:54 +08:00
hls: apply readTimeout to HLS sources (#2627)
This commit is contained in:
@@ -83,6 +83,7 @@ func newStaticSourceHandler(
|
||||
case strings.HasPrefix(cnf.Source, "http://") ||
|
||||
strings.HasPrefix(cnf.Source, "https://"):
|
||||
s.instance = &hlssource.Source{
|
||||
ReadTimeout: readTimeout,
|
||||
Parent: s,
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
|
||||
"github.com/bluenviron/mediamtx/internal/conf"
|
||||
"github.com/bluenviron/mediamtx/internal/defs"
|
||||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/protocols/tls"
|
||||
@@ -19,6 +20,7 @@ import (
|
||||
|
||||
// Source is a HLS static source.
|
||||
type Source struct {
|
||||
ReadTimeout conf.StringDuration
|
||||
Parent defs.StaticSourceParent
|
||||
}
|
||||
|
||||
@@ -43,6 +45,7 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
|
||||
c = &gohlslib.Client{
|
||||
URI: params.Conf.Source,
|
||||
HTTPClient: &http.Client{
|
||||
Timeout: time.Duration(s.ReadTimeout),
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: tls.ConfigForFingerprint(params.Conf.SourceFingerprint),
|
||||
},
|
||||
|
@@ -20,7 +20,6 @@ import (
|
||||
// Source is a WebRTC static source.
|
||||
type Source struct {
|
||||
ReadTimeout conf.StringDuration
|
||||
|
||||
Parent defs.StaticSourceParent
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user