diff --git a/internal/core/static_source_handler.go b/internal/core/static_source_handler.go index cec9961e..34184cd8 100644 --- a/internal/core/static_source_handler.go +++ b/internal/core/static_source_handler.go @@ -83,7 +83,8 @@ func newStaticSourceHandler( case strings.HasPrefix(cnf.Source, "http://") || strings.HasPrefix(cnf.Source, "https://"): s.instance = &hlssource.Source{ - Parent: s, + ReadTimeout: readTimeout, + Parent: s, } case strings.HasPrefix(cnf.Source, "udp://"): diff --git a/internal/staticsources/hls/source.go b/internal/staticsources/hls/source.go index 4725566e..b8d3fd1b 100644 --- a/internal/staticsources/hls/source.go +++ b/internal/staticsources/hls/source.go @@ -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,7 +20,8 @@ import ( // Source is a HLS static source. type Source struct { - Parent defs.StaticSourceParent + ReadTimeout conf.StringDuration + Parent defs.StaticSourceParent } // Log implements StaticSource. @@ -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), }, diff --git a/internal/staticsources/webrtc/source.go b/internal/staticsources/webrtc/source.go index c5c4ee7c..05f8c122 100644 --- a/internal/staticsources/webrtc/source.go +++ b/internal/staticsources/webrtc/source.go @@ -20,8 +20,7 @@ import ( // Source is a WebRTC static source. type Source struct { ReadTimeout conf.StringDuration - - Parent defs.StaticSourceParent + Parent defs.StaticSourceParent } // Log implements StaticSource.