mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
cleanup
This commit is contained in:
parent
bf92496af0
commit
0a1b8eee25
3 changed files with 26 additions and 26 deletions
|
|
@ -102,7 +102,7 @@ type Conf struct {
|
||||||
HLSSegmentDuration time.Duration `yaml:"hlsSegmentDuration"`
|
HLSSegmentDuration time.Duration `yaml:"hlsSegmentDuration"`
|
||||||
HLSAllowOrigin string `yaml:"hlsAllowOrigin"`
|
HLSAllowOrigin string `yaml:"hlsAllowOrigin"`
|
||||||
|
|
||||||
// path
|
// paths
|
||||||
Paths map[string]*PathConf `yaml:"paths"`
|
Paths map[string]*PathConf `yaml:"paths"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
48
main.go
48
main.go
|
|
@ -35,10 +35,10 @@ type program struct {
|
||||||
metrics *metrics.Metrics
|
metrics *metrics.Metrics
|
||||||
pprof *pprof.PPROF
|
pprof *pprof.PPROF
|
||||||
pathMan *pathman.PathManager
|
pathMan *pathman.PathManager
|
||||||
serverRTSPPlain *rtspserver.Server
|
rtspServerPlain *rtspserver.Server
|
||||||
serverRTSPTLS *rtspserver.Server
|
rtspServerTLS *rtspserver.Server
|
||||||
serverRTMP *rtmpserver.Server
|
rtmpServer *rtmpserver.Server
|
||||||
serverHLS *hlsserver.Server
|
hlsServer *hlsserver.Server
|
||||||
confWatcher *confwatcher.ConfWatcher
|
confWatcher *confwatcher.ConfWatcher
|
||||||
|
|
||||||
// out
|
// out
|
||||||
|
|
@ -213,10 +213,10 @@ func (p *program) createResources(initial bool) error {
|
||||||
if !p.conf.RTSPDisable &&
|
if !p.conf.RTSPDisable &&
|
||||||
(p.conf.EncryptionParsed == conf.EncryptionNo ||
|
(p.conf.EncryptionParsed == conf.EncryptionNo ||
|
||||||
p.conf.EncryptionParsed == conf.EncryptionOptional) {
|
p.conf.EncryptionParsed == conf.EncryptionOptional) {
|
||||||
if p.serverRTSPPlain == nil {
|
if p.rtspServerPlain == nil {
|
||||||
_, useUDP := p.conf.ProtocolsParsed[conf.ProtocolUDP]
|
_, useUDP := p.conf.ProtocolsParsed[conf.ProtocolUDP]
|
||||||
_, useMulticast := p.conf.ProtocolsParsed[conf.ProtocolMulticast]
|
_, useMulticast := p.conf.ProtocolsParsed[conf.ProtocolMulticast]
|
||||||
p.serverRTSPPlain, err = rtspserver.New(
|
p.rtspServerPlain, err = rtspserver.New(
|
||||||
p.ctx,
|
p.ctx,
|
||||||
p.conf.RTSPAddress,
|
p.conf.RTSPAddress,
|
||||||
p.conf.ReadTimeout,
|
p.conf.ReadTimeout,
|
||||||
|
|
@ -249,8 +249,8 @@ func (p *program) createResources(initial bool) error {
|
||||||
if !p.conf.RTSPDisable &&
|
if !p.conf.RTSPDisable &&
|
||||||
(p.conf.EncryptionParsed == conf.EncryptionStrict ||
|
(p.conf.EncryptionParsed == conf.EncryptionStrict ||
|
||||||
p.conf.EncryptionParsed == conf.EncryptionOptional) {
|
p.conf.EncryptionParsed == conf.EncryptionOptional) {
|
||||||
if p.serverRTSPTLS == nil {
|
if p.rtspServerTLS == nil {
|
||||||
p.serverRTSPTLS, err = rtspserver.New(
|
p.rtspServerTLS, err = rtspserver.New(
|
||||||
p.ctx,
|
p.ctx,
|
||||||
p.conf.RTSPSAddress,
|
p.conf.RTSPSAddress,
|
||||||
p.conf.ReadTimeout,
|
p.conf.ReadTimeout,
|
||||||
|
|
@ -281,8 +281,8 @@ func (p *program) createResources(initial bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !p.conf.RTMPDisable {
|
if !p.conf.RTMPDisable {
|
||||||
if p.serverRTMP == nil {
|
if p.rtmpServer == nil {
|
||||||
p.serverRTMP, err = rtmpserver.New(
|
p.rtmpServer, err = rtmpserver.New(
|
||||||
p.ctx,
|
p.ctx,
|
||||||
p.conf.RTMPAddress,
|
p.conf.RTMPAddress,
|
||||||
p.conf.ReadTimeout,
|
p.conf.ReadTimeout,
|
||||||
|
|
@ -301,8 +301,8 @@ func (p *program) createResources(initial bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !p.conf.HLSDisable {
|
if !p.conf.HLSDisable {
|
||||||
if p.serverHLS == nil {
|
if p.hlsServer == nil {
|
||||||
p.serverHLS, err = hlsserver.New(
|
p.hlsServer, err = hlsserver.New(
|
||||||
p.ctx,
|
p.ctx,
|
||||||
p.conf.HLSAddress,
|
p.conf.HLSAddress,
|
||||||
p.conf.HLSSegmentCount,
|
p.conf.HLSSegmentCount,
|
||||||
|
|
@ -434,14 +434,14 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
||||||
closeServerHLS = true
|
closeServerHLS = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if closeServerTLS && p.serverRTSPTLS != nil {
|
if closeServerTLS && p.rtspServerTLS != nil {
|
||||||
p.serverRTSPTLS.Close()
|
p.rtspServerTLS.Close()
|
||||||
p.serverRTSPTLS = nil
|
p.rtspServerTLS = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if closeServerPlain && p.serverRTSPPlain != nil {
|
if closeServerPlain && p.rtspServerPlain != nil {
|
||||||
p.serverRTSPPlain.Close()
|
p.rtspServerPlain.Close()
|
||||||
p.serverRTSPPlain = nil
|
p.rtspServerPlain = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if closePathMan && p.pathMan != nil {
|
if closePathMan && p.pathMan != nil {
|
||||||
|
|
@ -449,14 +449,14 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
||||||
p.pathMan = nil
|
p.pathMan = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if closeServerHLS && p.serverHLS != nil {
|
if closeServerHLS && p.hlsServer != nil {
|
||||||
p.serverHLS.Close()
|
p.hlsServer.Close()
|
||||||
p.serverHLS = nil
|
p.hlsServer = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if closeServerRTMP && p.serverRTMP != nil {
|
if closeServerRTMP && p.rtmpServer != nil {
|
||||||
p.serverRTMP.Close()
|
p.rtmpServer.Close()
|
||||||
p.serverRTMP = nil
|
p.rtmpServer = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if closePPROF && p.pprof != nil {
|
if closePPROF && p.pprof != nil {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ runOnConnectRestart: no
|
||||||
# disable support for the RTSP protocol.
|
# disable support for the RTSP protocol.
|
||||||
rtspDisable: no
|
rtspDisable: no
|
||||||
# supported RTSP stream protocols.
|
# supported RTSP stream protocols.
|
||||||
# UDP is the most performant, but can cause problems if there's a NAT between
|
# UDP is the most performant, but doesn't work when there's a NAT/firewall between
|
||||||
# server and clients, and doesn't support encryption.
|
# server and clients, and doesn't support encryption.
|
||||||
# UDP-multicast allows to save bandwidth when clients are all in the same LAN.
|
# UDP-multicast allows to save bandwidth when clients are all in the same LAN.
|
||||||
# TCP is the most versatile, and does support encryption.
|
# TCP is the most versatile, and does support encryption.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue