accept durations expressed as days (i.e. '1d') (#4094)

This commit is contained in:
Alessandro Ros
2025-01-02 12:44:15 +01:00
committed by GitHub
parent 8cbbbc05c3
commit b49acb1e00
53 changed files with 378 additions and 257 deletions

View File

@@ -136,7 +136,7 @@ type API struct {
ServerCert string ServerCert string
AllowOrigin string AllowOrigin string
TrustedProxies conf.IPNetworks TrustedProxies conf.IPNetworks
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
Conf *conf.Conf Conf *conf.Conf
AuthManager apiAuthManager AuthManager apiAuthManager
PathManager PathManager PathManager PathManager

View File

@@ -77,7 +77,7 @@ func TestPreflightRequest(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
AllowOrigin: "*", AllowOrigin: "*",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
} }
@@ -115,7 +115,7 @@ func TestConfigGlobalGet(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -138,7 +138,7 @@ func TestConfigGlobalPatch(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -174,7 +174,7 @@ func TestConfigGlobalPatchUnknownField(t *testing.T) { //nolint:dupl
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -211,7 +211,7 @@ func TestConfigPathDefaultsGet(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -234,7 +234,7 @@ func TestConfigPathDefaultsPatch(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -271,7 +271,7 @@ func TestConfigPathsList(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -313,7 +313,7 @@ func TestConfigPathsGet(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -337,7 +337,7 @@ func TestConfigPathsAdd(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -371,7 +371,7 @@ func TestConfigPathsAddUnknownField(t *testing.T) { //nolint:dupl
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -408,7 +408,7 @@ func TestConfigPathsPatch(t *testing.T) { //nolint:dupl
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -448,7 +448,7 @@ func TestConfigPathsReplace(t *testing.T) { //nolint:dupl
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -488,7 +488,7 @@ func TestConfigPathsReplaceNonExisting(t *testing.T) { //nolint:dupl
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -520,7 +520,7 @@ func TestConfigPathsDelete(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -565,7 +565,7 @@ func TestRecordingsList(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -634,7 +634,7 @@ func TestRecordingsGet(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},
@@ -683,7 +683,7 @@ func TestRecordingsDeleteSegment(t *testing.T) {
api := API{ api := API{
Address: "localhost:9997", Address: "localhost:9997",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Conf: cnf, Conf: cnf,
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: &testParent{}, Parent: &testParent{},

View File

@@ -161,8 +161,8 @@ type Conf struct {
LogLevel LogLevel `json:"logLevel"` LogLevel LogLevel `json:"logLevel"`
LogDestinations LogDestinations `json:"logDestinations"` LogDestinations LogDestinations `json:"logDestinations"`
LogFile string `json:"logFile"` LogFile string `json:"logFile"`
ReadTimeout StringDuration `json:"readTimeout"` ReadTimeout Duration `json:"readTimeout"`
WriteTimeout StringDuration `json:"writeTimeout"` WriteTimeout Duration `json:"writeTimeout"`
ReadBufferCount *int `json:"readBufferCount,omitempty"` // deprecated ReadBufferCount *int `json:"readBufferCount,omitempty"` // deprecated
WriteQueueSize int `json:"writeQueueSize"` WriteQueueSize int `json:"writeQueueSize"`
UDPMaxPayloadSize int `json:"udpMaxPayloadSize"` UDPMaxPayloadSize int `json:"udpMaxPayloadSize"`
@@ -246,22 +246,22 @@ type Conf struct {
RTMPServerCert string `json:"rtmpServerCert"` RTMPServerCert string `json:"rtmpServerCert"`
// HLS server // HLS server
HLS bool `json:"hls"` HLS bool `json:"hls"`
HLSDisable *bool `json:"hlsDisable,omitempty"` // deprecated HLSDisable *bool `json:"hlsDisable,omitempty"` // deprecated
HLSAddress string `json:"hlsAddress"` HLSAddress string `json:"hlsAddress"`
HLSEncryption bool `json:"hlsEncryption"` HLSEncryption bool `json:"hlsEncryption"`
HLSServerKey string `json:"hlsServerKey"` HLSServerKey string `json:"hlsServerKey"`
HLSServerCert string `json:"hlsServerCert"` HLSServerCert string `json:"hlsServerCert"`
HLSAllowOrigin string `json:"hlsAllowOrigin"` HLSAllowOrigin string `json:"hlsAllowOrigin"`
HLSTrustedProxies IPNetworks `json:"hlsTrustedProxies"` HLSTrustedProxies IPNetworks `json:"hlsTrustedProxies"`
HLSAlwaysRemux bool `json:"hlsAlwaysRemux"` HLSAlwaysRemux bool `json:"hlsAlwaysRemux"`
HLSVariant HLSVariant `json:"hlsVariant"` HLSVariant HLSVariant `json:"hlsVariant"`
HLSSegmentCount int `json:"hlsSegmentCount"` HLSSegmentCount int `json:"hlsSegmentCount"`
HLSSegmentDuration StringDuration `json:"hlsSegmentDuration"` HLSSegmentDuration Duration `json:"hlsSegmentDuration"`
HLSPartDuration StringDuration `json:"hlsPartDuration"` HLSPartDuration Duration `json:"hlsPartDuration"`
HLSSegmentMaxSize StringSize `json:"hlsSegmentMaxSize"` HLSSegmentMaxSize StringSize `json:"hlsSegmentMaxSize"`
HLSDirectory string `json:"hlsDirectory"` HLSDirectory string `json:"hlsDirectory"`
HLSMuxerCloseAfter StringDuration `json:"hlsMuxerCloseAfter"` HLSMuxerCloseAfter Duration `json:"hlsMuxerCloseAfter"`
// WebRTC server // WebRTC server
WebRTC bool `json:"webrtc"` WebRTC bool `json:"webrtc"`
@@ -278,8 +278,8 @@ type Conf struct {
WebRTCIPsFromInterfacesList []string `json:"webrtcIPsFromInterfacesList"` WebRTCIPsFromInterfacesList []string `json:"webrtcIPsFromInterfacesList"`
WebRTCAdditionalHosts []string `json:"webrtcAdditionalHosts"` WebRTCAdditionalHosts []string `json:"webrtcAdditionalHosts"`
WebRTCICEServers2 WebRTCICEServers `json:"webrtcICEServers2"` WebRTCICEServers2 WebRTCICEServers `json:"webrtcICEServers2"`
WebRTCHandshakeTimeout StringDuration `json:"webrtcHandshakeTimeout"` WebRTCHandshakeTimeout Duration `json:"webrtcHandshakeTimeout"`
WebRTCTrackGatherTimeout StringDuration `json:"webrtcTrackGatherTimeout"` WebRTCTrackGatherTimeout Duration `json:"webrtcTrackGatherTimeout"`
WebRTCICEUDPMuxAddress *string `json:"webrtcICEUDPMuxAddress,omitempty"` // deprecated WebRTCICEUDPMuxAddress *string `json:"webrtcICEUDPMuxAddress,omitempty"` // deprecated
WebRTCICETCPMuxAddress *string `json:"webrtcICETCPMuxAddress,omitempty"` // deprecated WebRTCICETCPMuxAddress *string `json:"webrtcICETCPMuxAddress,omitempty"` // deprecated
WebRTCICEHostNAT1To1IPs *[]string `json:"webrtcICEHostNAT1To1IPs,omitempty"` // deprecated WebRTCICEHostNAT1To1IPs *[]string `json:"webrtcICEHostNAT1To1IPs,omitempty"` // deprecated
@@ -290,12 +290,12 @@ type Conf struct {
SRTAddress string `json:"srtAddress"` SRTAddress string `json:"srtAddress"`
// Record (deprecated) // Record (deprecated)
Record *bool `json:"record,omitempty"` // deprecated Record *bool `json:"record,omitempty"` // deprecated
RecordPath *string `json:"recordPath,omitempty"` // deprecated RecordPath *string `json:"recordPath,omitempty"` // deprecated
RecordFormat *RecordFormat `json:"recordFormat,omitempty"` // deprecated RecordFormat *RecordFormat `json:"recordFormat,omitempty"` // deprecated
RecordPartDuration *StringDuration `json:"recordPartDuration,omitempty"` // deprecated RecordPartDuration *Duration `json:"recordPartDuration,omitempty"` // deprecated
RecordSegmentDuration *StringDuration `json:"recordSegmentDuration,omitempty"` // deprecated RecordSegmentDuration *Duration `json:"recordSegmentDuration,omitempty"` // deprecated
RecordDeleteAfter *StringDuration `json:"recordDeleteAfter,omitempty"` // deprecated RecordDeleteAfter *Duration `json:"recordDeleteAfter,omitempty"` // deprecated
// Path defaults // Path defaults
PathDefaults Path `json:"pathDefaults"` PathDefaults Path `json:"pathDefaults"`
@@ -310,8 +310,8 @@ func (conf *Conf) setDefaults() {
conf.LogLevel = LogLevel(logger.Info) conf.LogLevel = LogLevel(logger.Info)
conf.LogDestinations = LogDestinations{logger.DestinationStdout} conf.LogDestinations = LogDestinations{logger.DestinationStdout}
conf.LogFile = "mediamtx.log" conf.LogFile = "mediamtx.log"
conf.ReadTimeout = 10 * StringDuration(time.Second) conf.ReadTimeout = 10 * Duration(time.Second)
conf.WriteTimeout = 10 * StringDuration(time.Second) conf.WriteTimeout = 10 * Duration(time.Second)
conf.WriteQueueSize = 512 conf.WriteQueueSize = 512
conf.UDPMaxPayloadSize = 1472 conf.UDPMaxPayloadSize = 1472
@@ -387,10 +387,10 @@ func (conf *Conf) setDefaults() {
conf.HLSAllowOrigin = "*" conf.HLSAllowOrigin = "*"
conf.HLSVariant = HLSVariant(gohlslib.MuxerVariantLowLatency) conf.HLSVariant = HLSVariant(gohlslib.MuxerVariantLowLatency)
conf.HLSSegmentCount = 7 conf.HLSSegmentCount = 7
conf.HLSSegmentDuration = 1 * StringDuration(time.Second) conf.HLSSegmentDuration = 1 * Duration(time.Second)
conf.HLSPartDuration = 200 * StringDuration(time.Millisecond) conf.HLSPartDuration = 200 * Duration(time.Millisecond)
conf.HLSSegmentMaxSize = 50 * 1024 * 1024 conf.HLSSegmentMaxSize = 50 * 1024 * 1024
conf.HLSMuxerCloseAfter = 60 * StringDuration(time.Second) conf.HLSMuxerCloseAfter = 60 * Duration(time.Second)
// WebRTC server // WebRTC server
conf.WebRTC = true conf.WebRTC = true
@@ -403,8 +403,8 @@ func (conf *Conf) setDefaults() {
conf.WebRTCIPsFromInterfacesList = []string{} conf.WebRTCIPsFromInterfacesList = []string{}
conf.WebRTCAdditionalHosts = []string{} conf.WebRTCAdditionalHosts = []string{}
conf.WebRTCICEServers2 = []WebRTCICEServer{} conf.WebRTCICEServers2 = []WebRTCICEServer{}
conf.WebRTCHandshakeTimeout = 10 * StringDuration(time.Second) conf.WebRTCHandshakeTimeout = 10 * Duration(time.Second)
conf.WebRTCTrackGatherTimeout = 2 * StringDuration(time.Second) conf.WebRTCTrackGatherTimeout = 2 * Duration(time.Second)
// SRT server // SRT server
conf.SRT = true conf.SRT = true

View File

@@ -50,11 +50,11 @@ func TestConfFromFile(t *testing.T) {
require.Equal(t, &Path{ require.Equal(t, &Path{
Name: "cam1", Name: "cam1",
Source: "publisher", Source: "publisher",
SourceOnDemandStartTimeout: 10 * StringDuration(time.Second), SourceOnDemandStartTimeout: 10 * Duration(time.Second),
SourceOnDemandCloseAfter: 10 * StringDuration(time.Second), SourceOnDemandCloseAfter: 10 * Duration(time.Second),
RecordPath: "./recordings/%path/%Y-%m-%d_%H-%M-%S-%f", RecordPath: "./recordings/%path/%Y-%m-%d_%H-%M-%S-%f",
RecordFormat: RecordFormatFMP4, RecordFormat: RecordFormatFMP4,
RecordPartDuration: StringDuration(1 * time.Second), RecordPartDuration: Duration(1 * time.Second),
RecordSegmentDuration: 3600000000000, RecordSegmentDuration: 3600000000000,
RecordDeleteAfter: 86400000000000, RecordDeleteAfter: 86400000000000,
OverridePublisher: true, OverridePublisher: true,
@@ -78,8 +78,8 @@ func TestConfFromFile(t *testing.T) {
RPICameraBitrate: 5000000, RPICameraBitrate: 5000000,
RPICameraProfile: "main", RPICameraProfile: "main",
RPICameraLevel: "4.1", RPICameraLevel: "4.1",
RunOnDemandStartTimeout: 5 * StringDuration(time.Second), RunOnDemandStartTimeout: 5 * Duration(time.Second),
RunOnDemandCloseAfter: 10 * StringDuration(time.Second), RunOnDemandCloseAfter: 10 * Duration(time.Second),
}, pa) }, pa)
}() }()

101
internal/conf/duration.go Normal file
View File

@@ -0,0 +1,101 @@
package conf
import (
"encoding/json"
"regexp"
"strconv"
"time"
)
var reDays = regexp.MustCompile("^(-?[0-9]+)d")
// Duration is a duration. It differs from the standard duration in these ways:
// - it is unmarshaled/marshaled from/to a string (instead of a number)
// - it supports days
type Duration time.Duration
func (d Duration) marshalInternal() string {
negative := false
if d < 0 {
negative = true
d = -d
}
day := Duration(86400 * time.Second)
days := d / day
nonDays := d % day
ret := ""
if negative {
ret += "-"
}
if days > 0 {
ret += strconv.FormatInt(int64(days), 10) + "d"
}
if nonDays != 0 {
ret += time.Duration(nonDays).String()
}
return ret
}
// MarshalJSON implements json.Marshaler.
func (d Duration) MarshalJSON() ([]byte, error) {
return json.Marshal(d.marshalInternal())
}
func (d *Duration) unmarshalInternal(in string) error {
negative := false
days := int64(0)
m := reDays.FindStringSubmatch(in)
if m != nil {
days, _ = strconv.ParseInt(m[1], 10, 64)
if days < 0 {
negative = true
days = -days
}
in = in[len(m[0]):]
}
var nonDays time.Duration
if len(in) != 0 {
var err error
nonDays, err = time.ParseDuration(in)
if err != nil {
return err
}
}
nonDays += time.Duration(days) * 24 * time.Hour
if negative {
nonDays = -nonDays
}
*d = Duration(nonDays)
return nil
}
// UnmarshalJSON implements json.Unmarshaler.
func (d *Duration) UnmarshalJSON(b []byte) error {
var in string
if err := json.Unmarshal(b, &in); err != nil {
return err
}
err := d.unmarshalInternal(in)
if err != nil {
return err
}
return nil
}
// UnmarshalEnv implements env.Unmarshaler.
func (d *Duration) UnmarshalEnv(_ string, v string) error {
return d.UnmarshalJSON([]byte(`"` + v + `"`))
}

View File

@@ -0,0 +1,56 @@
package conf
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
var casesDuration = []struct {
name string
dec Duration
enc string
}{
{
"standard",
Duration(13456 * time.Second),
`"3h44m16s"`,
},
{
"days",
Duration(50 * 13456 * time.Second),
`"7d18h53m20s"`,
},
{
"days negative",
Duration(-50 * 13456 * time.Second),
`"-7d18h53m20s"`,
},
{
"days even",
Duration(7 * 24 * time.Hour),
`"7d"`,
},
}
func TestDurationUnmarshal(t *testing.T) {
for _, ca := range casesDuration {
t.Run(ca.name, func(t *testing.T) {
var dec Duration
err := dec.UnmarshalJSON([]byte(ca.enc))
require.NoError(t, err)
require.Equal(t, ca.dec, dec)
})
}
}
func TestDurationMarshal(t *testing.T) {
for _, ca := range casesDuration {
t.Run(ca.name, func(t *testing.T) {
enc, err := ca.dec.MarshalJSON()
require.NoError(t, err)
require.Equal(t, ca.enc, string(enc))
})
}
}

View File

@@ -88,23 +88,23 @@ type Path struct {
Name string `json:"name"` // filled by Check() Name string `json:"name"` // filled by Check()
// General // General
Source string `json:"source"` Source string `json:"source"`
SourceFingerprint string `json:"sourceFingerprint"` SourceFingerprint string `json:"sourceFingerprint"`
SourceOnDemand bool `json:"sourceOnDemand"` SourceOnDemand bool `json:"sourceOnDemand"`
SourceOnDemandStartTimeout StringDuration `json:"sourceOnDemandStartTimeout"` SourceOnDemandStartTimeout Duration `json:"sourceOnDemandStartTimeout"`
SourceOnDemandCloseAfter StringDuration `json:"sourceOnDemandCloseAfter"` SourceOnDemandCloseAfter Duration `json:"sourceOnDemandCloseAfter"`
MaxReaders int `json:"maxReaders"` MaxReaders int `json:"maxReaders"`
SRTReadPassphrase string `json:"srtReadPassphrase"` SRTReadPassphrase string `json:"srtReadPassphrase"`
Fallback string `json:"fallback"` Fallback string `json:"fallback"`
// Record // Record
Record bool `json:"record"` Record bool `json:"record"`
Playback *bool `json:"playback,omitempty"` // deprecated Playback *bool `json:"playback,omitempty"` // deprecated
RecordPath string `json:"recordPath"` RecordPath string `json:"recordPath"`
RecordFormat RecordFormat `json:"recordFormat"` RecordFormat RecordFormat `json:"recordFormat"`
RecordPartDuration StringDuration `json:"recordPartDuration"` RecordPartDuration Duration `json:"recordPartDuration"`
RecordSegmentDuration StringDuration `json:"recordSegmentDuration"` RecordSegmentDuration Duration `json:"recordSegmentDuration"`
RecordDeleteAfter StringDuration `json:"recordDeleteAfter"` RecordDeleteAfter Duration `json:"recordDeleteAfter"`
// Authentication (deprecated) // Authentication (deprecated)
PublishUser *Credential `json:"publishUser,omitempty"` // deprecated PublishUser *Credential `json:"publishUser,omitempty"` // deprecated
@@ -168,35 +168,35 @@ type Path struct {
RPICameraLevel string `json:"rpiCameraLevel"` RPICameraLevel string `json:"rpiCameraLevel"`
// Hooks // Hooks
RunOnInit string `json:"runOnInit"` RunOnInit string `json:"runOnInit"`
RunOnInitRestart bool `json:"runOnInitRestart"` RunOnInitRestart bool `json:"runOnInitRestart"`
RunOnDemand string `json:"runOnDemand"` RunOnDemand string `json:"runOnDemand"`
RunOnDemandRestart bool `json:"runOnDemandRestart"` RunOnDemandRestart bool `json:"runOnDemandRestart"`
RunOnDemandStartTimeout StringDuration `json:"runOnDemandStartTimeout"` RunOnDemandStartTimeout Duration `json:"runOnDemandStartTimeout"`
RunOnDemandCloseAfter StringDuration `json:"runOnDemandCloseAfter"` RunOnDemandCloseAfter Duration `json:"runOnDemandCloseAfter"`
RunOnUnDemand string `json:"runOnUnDemand"` RunOnUnDemand string `json:"runOnUnDemand"`
RunOnReady string `json:"runOnReady"` RunOnReady string `json:"runOnReady"`
RunOnReadyRestart bool `json:"runOnReadyRestart"` RunOnReadyRestart bool `json:"runOnReadyRestart"`
RunOnNotReady string `json:"runOnNotReady"` RunOnNotReady string `json:"runOnNotReady"`
RunOnRead string `json:"runOnRead"` RunOnRead string `json:"runOnRead"`
RunOnReadRestart bool `json:"runOnReadRestart"` RunOnReadRestart bool `json:"runOnReadRestart"`
RunOnUnread string `json:"runOnUnread"` RunOnUnread string `json:"runOnUnread"`
RunOnRecordSegmentCreate string `json:"runOnRecordSegmentCreate"` RunOnRecordSegmentCreate string `json:"runOnRecordSegmentCreate"`
RunOnRecordSegmentComplete string `json:"runOnRecordSegmentComplete"` RunOnRecordSegmentComplete string `json:"runOnRecordSegmentComplete"`
} }
func (pconf *Path) setDefaults() { func (pconf *Path) setDefaults() {
// General // General
pconf.Source = "publisher" pconf.Source = "publisher"
pconf.SourceOnDemandStartTimeout = 10 * StringDuration(time.Second) pconf.SourceOnDemandStartTimeout = 10 * Duration(time.Second)
pconf.SourceOnDemandCloseAfter = 10 * StringDuration(time.Second) pconf.SourceOnDemandCloseAfter = 10 * Duration(time.Second)
// Record // Record
pconf.RecordPath = "./recordings/%path/%Y-%m-%d_%H-%M-%S-%f" pconf.RecordPath = "./recordings/%path/%Y-%m-%d_%H-%M-%S-%f"
pconf.RecordFormat = RecordFormatFMP4 pconf.RecordFormat = RecordFormatFMP4
pconf.RecordPartDuration = StringDuration(1 * time.Second) pconf.RecordPartDuration = Duration(1 * time.Second)
pconf.RecordSegmentDuration = 3600 * StringDuration(time.Second) pconf.RecordSegmentDuration = 3600 * Duration(time.Second)
pconf.RecordDeleteAfter = 24 * 3600 * StringDuration(time.Second) pconf.RecordDeleteAfter = 24 * 3600 * Duration(time.Second)
// Publisher source // Publisher source
pconf.OverridePublisher = true pconf.OverridePublisher = true
@@ -224,8 +224,8 @@ func (pconf *Path) setDefaults() {
pconf.RPICameraLevel = "4.1" pconf.RPICameraLevel = "4.1"
// Hooks // Hooks
pconf.RunOnDemandStartTimeout = 10 * StringDuration(time.Second) pconf.RunOnDemandStartTimeout = 10 * Duration(time.Second)
pconf.RunOnDemandCloseAfter = 10 * StringDuration(time.Second) pconf.RunOnDemandCloseAfter = 10 * Duration(time.Second)
} }
func newPath(defaults *Path, partial *OptionalPath) *Path { func newPath(defaults *Path, partial *OptionalPath) *Path {

View File

@@ -1,36 +0,0 @@
package conf
import (
"encoding/json"
"time"
)
// StringDuration is a duration that is unmarshaled from a string.
// Durations are normally unmarshaled from numbers.
type StringDuration time.Duration
// MarshalJSON implements json.Marshaler.
func (d StringDuration) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Duration(d).String())
}
// UnmarshalJSON implements json.Unmarshaler.
func (d *StringDuration) UnmarshalJSON(b []byte) error {
var in string
if err := json.Unmarshal(b, &in); err != nil {
return err
}
du, err := time.ParseDuration(in)
if err != nil {
return err
}
*d = StringDuration(du)
return nil
}
// UnmarshalEnv implements env.Unmarshaler.
func (d *StringDuration) UnmarshalEnv(_ string, v string) error {
return d.UnmarshalJSON([]byte(`"` + v + `"`))
}

View File

@@ -67,8 +67,8 @@ type path struct {
parentCtx context.Context parentCtx context.Context
logLevel conf.LogLevel logLevel conf.LogLevel
rtspAddress string rtspAddress string
readTimeout conf.StringDuration readTimeout conf.Duration
writeTimeout conf.StringDuration writeTimeout conf.Duration
writeQueueSize int writeQueueSize int
udpMaxPayloadSize int udpMaxPayloadSize int
conf *conf.Path conf *conf.Path

View File

@@ -52,8 +52,8 @@ type pathManager struct {
logLevel conf.LogLevel logLevel conf.LogLevel
authManager *auth.Manager authManager *auth.Manager
rtspAddress string rtspAddress string
readTimeout conf.StringDuration readTimeout conf.Duration
writeTimeout conf.StringDuration writeTimeout conf.Duration
writeQueueSize int writeQueueSize int
udpMaxPayloadSize int udpMaxPayloadSize int
pathConfs map[string]*conf.Path pathConfs map[string]*conf.Path

View File

@@ -45,8 +45,8 @@ type staticSourceHandlerParent interface {
type staticSourceHandler struct { type staticSourceHandler struct {
conf *conf.Path conf *conf.Path
logLevel conf.LogLevel logLevel conf.LogLevel
readTimeout conf.StringDuration readTimeout conf.Duration
writeTimeout conf.StringDuration writeTimeout conf.Duration
writeQueueSize int writeQueueSize int
matches []string matches []string
parent staticSourceHandlerParent parent staticSourceHandlerParent

View File

@@ -48,7 +48,7 @@ type Metrics struct {
ServerCert string ServerCert string
AllowOrigin string AllowOrigin string
TrustedProxies conf.IPNetworks TrustedProxies conf.IPNetworks
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
AuthManager metricsAuthManager AuthManager metricsAuthManager
Parent metricsParent Parent metricsParent

View File

@@ -15,7 +15,7 @@ func TestPreflightRequest(t *testing.T) {
api := Metrics{ api := Metrics{
Address: "localhost:9998", Address: "localhost:9998",
AllowOrigin: "*", AllowOrigin: "*",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: test.NilLogger, Parent: test.NilLogger,
} }

View File

@@ -231,7 +231,7 @@ func TestOnGet(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:9996", Address: "127.0.0.1:9996",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathConfs: map[string]*conf.Path{ PathConfs: map[string]*conf.Path{
"mypath": { "mypath": {
Name: "mypath", Name: "mypath",
@@ -505,7 +505,7 @@ func TestOnGetDifferentInit(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:9996", Address: "127.0.0.1:9996",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathConfs: map[string]*conf.Path{ PathConfs: map[string]*conf.Path{
"mypath": { "mypath": {
Name: "mypath", Name: "mypath",
@@ -581,7 +581,7 @@ func TestOnGetNTPCompensation(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:9996", Address: "127.0.0.1:9996",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathConfs: map[string]*conf.Path{ PathConfs: map[string]*conf.Path{
"mypath": { "mypath": {
Name: "mypath", Name: "mypath",

View File

@@ -28,7 +28,7 @@ func TestOnListUnfiltered(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:9996", Address: "127.0.0.1:9996",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathConfs: map[string]*conf.Path{ PathConfs: map[string]*conf.Path{
"mypath": { "mypath": {
Name: "mypath", Name: "mypath",
@@ -157,7 +157,7 @@ func TestOnListDifferentInit(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:9996", Address: "127.0.0.1:9996",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathConfs: map[string]*conf.Path{ PathConfs: map[string]*conf.Path{
"mypath": { "mypath": {
Name: "mypath", Name: "mypath",

View File

@@ -27,7 +27,7 @@ type Server struct {
ServerCert string ServerCert string
AllowOrigin string AllowOrigin string
TrustedProxies conf.IPNetworks TrustedProxies conf.IPNetworks
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
PathConfs map[string]*conf.Path PathConfs map[string]*conf.Path
AuthManager serverAuthManager AuthManager serverAuthManager
Parent logger.Writer Parent logger.Writer

View File

@@ -15,7 +15,7 @@ func TestPreflightRequest(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:9996", Address: "127.0.0.1:9996",
AllowOrigin: "*", AllowOrigin: "*",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Parent: test.NilLogger, Parent: test.NilLogger,
} }
err := s.Initialize() err := s.Initialize()

View File

@@ -32,7 +32,7 @@ type PPROF struct {
ServerCert string ServerCert string
AllowOrigin string AllowOrigin string
TrustedProxies conf.IPNetworks TrustedProxies conf.IPNetworks
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
AuthManager pprofAuthManager AuthManager pprofAuthManager
Parent pprofParent Parent pprofParent

View File

@@ -15,7 +15,7 @@ func TestPreflightRequest(t *testing.T) {
s := &PPROF{ s := &PPROF{
Address: "127.0.0.1:9999", Address: "127.0.0.1:9999",
AllowOrigin: "*", AllowOrigin: "*",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Parent: test.NilLogger, Parent: test.NilLogger,
} }
err := s.Initialize() err := s.Initialize()
@@ -51,7 +51,7 @@ func TestPprof(t *testing.T) {
s := &PPROF{ s := &PPROF{
Address: "127.0.0.1:9999", Address: "127.0.0.1:9999",
AllowOrigin: "*", AllowOrigin: "*",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
AuthManager: test.NilAuthManager, AuthManager: test.NilAuthManager,
Parent: test.NilLogger, Parent: test.NilLogger,
} }

View File

@@ -72,8 +72,8 @@ type PeerConnection struct {
ICEServers []webrtc.ICEServer ICEServers []webrtc.ICEServer
ICEUDPMux ice.UDPMux ICEUDPMux ice.UDPMux
ICETCPMux ice.TCPMux ICETCPMux ice.TCPMux
HandshakeTimeout conf.StringDuration HandshakeTimeout conf.Duration
TrackGatherTimeout conf.StringDuration TrackGatherTimeout conf.Duration
LocalRandomUDP bool LocalRandomUDP bool
IPsFromInterfaces bool IPsFromInterfaces bool
IPsFromInterfacesList []string IPsFromInterfacesList []string

View File

@@ -14,8 +14,8 @@ import (
func TestPeerConnectionCloseImmediately(t *testing.T) { func TestPeerConnectionCloseImmediately(t *testing.T) {
pc := &PeerConnection{ pc := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: false, Publish: false,
@@ -37,8 +37,8 @@ func TestPeerConnectionCloseImmediately(t *testing.T) {
// test that an audio codec is present regardless of the fact that an audio track is. // test that an audio codec is present regardless of the fact that an audio track is.
func TestPeerConnectionFallbackCodecs(t *testing.T) { func TestPeerConnectionFallbackCodecs(t *testing.T) {
pc1 := &PeerConnection{ pc1 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: false, Publish: false,
@@ -49,8 +49,8 @@ func TestPeerConnectionFallbackCodecs(t *testing.T) {
defer pc1.Close() defer pc1.Close()
pc2 := &PeerConnection{ pc2 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: true, Publish: true,

View File

@@ -336,8 +336,8 @@ func TestToStream(t *testing.T) {
for _, ca := range toFromStreamCases { for _, ca := range toFromStreamCases {
t.Run(ca.name, func(t *testing.T) { t.Run(ca.name, func(t *testing.T) {
pc1 := &PeerConnection{ pc1 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: true, Publish: true,
@@ -351,8 +351,8 @@ func TestToStream(t *testing.T) {
defer pc1.Close() defer pc1.Close()
pc2 := &PeerConnection{ pc2 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: false, Publish: false,

View File

@@ -46,8 +46,8 @@ func (c *Client) Publish(
c.pc = &webrtc.PeerConnection{ c.pc = &webrtc.PeerConnection{
ICEServers: iceServers, ICEServers: iceServers,
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: true, Publish: true,
@@ -122,8 +122,8 @@ func (c *Client) Read(ctx context.Context) ([]*webrtc.IncomingTrack, error) {
c.pc = &webrtc.PeerConnection{ c.pc = &webrtc.PeerConnection{
ICEServers: iceServers, ICEServers: iceServers,
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: false, Publish: false,

View File

@@ -39,7 +39,7 @@ func TestCleaner(t *testing.T) {
Regexp: regexp.MustCompile("^.*$"), Regexp: regexp.MustCompile("^.*$"),
RecordPath: filepath.Join(dir, specialChars+"_%path/%Y-%m-%d_%H-%M-%S-%f"), RecordPath: filepath.Join(dir, specialChars+"_%path/%Y-%m-%d_%H-%M-%S-%f"),
RecordFormat: conf.RecordFormatFMP4, RecordFormat: conf.RecordFormatFMP4,
RecordDeleteAfter: conf.StringDuration(10 * time.Second), RecordDeleteAfter: conf.Duration(10 * time.Second),
}, },
}, },
Parent: test.NilLogger, Parent: test.NilLogger,
@@ -83,13 +83,13 @@ func TestCleanerMultipleEntriesSamePath(t *testing.T) {
Name: "path1", Name: "path1",
RecordPath: filepath.Join(dir, "%path/%Y-%m-%d_%H-%M-%S-%f"), RecordPath: filepath.Join(dir, "%path/%Y-%m-%d_%H-%M-%S-%f"),
RecordFormat: conf.RecordFormatFMP4, RecordFormat: conf.RecordFormatFMP4,
RecordDeleteAfter: conf.StringDuration(10 * time.Second), RecordDeleteAfter: conf.Duration(10 * time.Second),
}, },
"path2": { "path2": {
Name: "path2", Name: "path2",
RecordPath: filepath.Join(dir, "%path/%Y-%m-%d_%H-%M-%S-%f"), RecordPath: filepath.Join(dir, "%path/%Y-%m-%d_%H-%M-%S-%f"),
RecordFormat: conf.RecordFormatFMP4, RecordFormat: conf.RecordFormatFMP4,
RecordDeleteAfter: conf.StringDuration(10 * 24 * time.Hour), RecordDeleteAfter: conf.Duration(10 * 24 * time.Hour),
}, },
}, },
Parent: test.NilLogger, Parent: test.NilLogger,

View File

@@ -42,7 +42,7 @@ type httpServer struct {
serverCert string serverCert string
allowOrigin string allowOrigin string
trustedProxies conf.IPNetworks trustedProxies conf.IPNetworks
readTimeout conf.StringDuration readTimeout conf.Duration
pathManager serverPathManager pathManager serverPathManager
parent *Server parent *Server

View File

@@ -50,11 +50,11 @@ type muxer struct {
remoteAddr string remoteAddr string
variant conf.HLSVariant variant conf.HLSVariant
segmentCount int segmentCount int
segmentDuration conf.StringDuration segmentDuration conf.Duration
partDuration conf.StringDuration partDuration conf.Duration
segmentMaxSize conf.StringSize segmentMaxSize conf.StringSize
directory string directory string
closeAfter conf.StringDuration closeAfter conf.Duration
wg *sync.WaitGroup wg *sync.WaitGroup
pathName string pathName string
pathManager serverPathManager pathManager serverPathManager

View File

@@ -17,8 +17,8 @@ import (
type muxerInstance struct { type muxerInstance struct {
variant conf.HLSVariant variant conf.HLSVariant
segmentCount int segmentCount int
segmentDuration conf.StringDuration segmentDuration conf.Duration
partDuration conf.StringDuration partDuration conf.Duration
segmentMaxSize conf.StringSize segmentMaxSize conf.StringSize
directory string directory string
pathName string pathName string

View File

@@ -69,12 +69,12 @@ type Server struct {
AlwaysRemux bool AlwaysRemux bool
Variant conf.HLSVariant Variant conf.HLSVariant
SegmentCount int SegmentCount int
SegmentDuration conf.StringDuration SegmentDuration conf.Duration
PartDuration conf.StringDuration PartDuration conf.Duration
SegmentMaxSize conf.StringSize SegmentMaxSize conf.StringSize
Directory string Directory string
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
MuxerCloseAfter conf.StringDuration MuxerCloseAfter conf.Duration
PathManager serverPathManager PathManager serverPathManager
Parent serverParent Parent serverParent

View File

@@ -65,7 +65,7 @@ func TestPreflightRequest(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:8888", Address: "127.0.0.1:8888",
AllowOrigin: "*", AllowOrigin: "*",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Parent: test.NilLogger, Parent: test.NilLogger,
} }
err := s.Initialize() err := s.Initialize()
@@ -122,13 +122,13 @@ func TestServerNotFound(t *testing.T) {
AlwaysRemux: ca == "always remux on", AlwaysRemux: ca == "always remux on",
Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS), Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS),
SegmentCount: 7, SegmentCount: 7,
SegmentDuration: conf.StringDuration(1 * time.Second), SegmentDuration: conf.Duration(1 * time.Second),
PartDuration: conf.StringDuration(200 * time.Millisecond), PartDuration: conf.Duration(200 * time.Millisecond),
SegmentMaxSize: 50 * 1024 * 1024, SegmentMaxSize: 50 * 1024 * 1024,
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
Directory: "", Directory: "",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathManager: pm, PathManager: pm,
Parent: test.NilLogger, Parent: test.NilLogger,
} }
@@ -195,13 +195,13 @@ func TestServerRead(t *testing.T) {
AlwaysRemux: false, AlwaysRemux: false,
Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS), Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS),
SegmentCount: 7, SegmentCount: 7,
SegmentDuration: conf.StringDuration(1 * time.Second), SegmentDuration: conf.Duration(1 * time.Second),
PartDuration: conf.StringDuration(200 * time.Millisecond), PartDuration: conf.Duration(200 * time.Millisecond),
SegmentMaxSize: 50 * 1024 * 1024, SegmentMaxSize: 50 * 1024 * 1024,
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
Directory: "", Directory: "",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathManager: pm, PathManager: pm,
Parent: test.NilLogger, Parent: test.NilLogger,
} }
@@ -290,13 +290,13 @@ func TestServerRead(t *testing.T) {
AlwaysRemux: true, AlwaysRemux: true,
Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS), Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS),
SegmentCount: 7, SegmentCount: 7,
SegmentDuration: conf.StringDuration(1 * time.Second), SegmentDuration: conf.Duration(1 * time.Second),
PartDuration: conf.StringDuration(200 * time.Millisecond), PartDuration: conf.Duration(200 * time.Millisecond),
SegmentMaxSize: 50 * 1024 * 1024, SegmentMaxSize: 50 * 1024 * 1024,
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
Directory: "", Directory: "",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathManager: pm, PathManager: pm,
Parent: test.NilLogger, Parent: test.NilLogger,
} }
@@ -385,13 +385,13 @@ func TestDirectory(t *testing.T) {
AlwaysRemux: true, AlwaysRemux: true,
Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS), Variant: conf.HLSVariant(gohlslib.MuxerVariantMPEGTS),
SegmentCount: 7, SegmentCount: 7,
SegmentDuration: conf.StringDuration(1 * time.Second), SegmentDuration: conf.Duration(1 * time.Second),
PartDuration: conf.StringDuration(200 * time.Millisecond), PartDuration: conf.Duration(200 * time.Millisecond),
SegmentMaxSize: 50 * 1024 * 1024, SegmentMaxSize: 50 * 1024 * 1024,
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
Directory: filepath.Join(dir, "mydir"), Directory: filepath.Join(dir, "mydir"),
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
PathManager: pm, PathManager: pm,
Parent: test.NilLogger, Parent: test.NilLogger,
} }

View File

@@ -42,8 +42,8 @@ type conn struct {
parentCtx context.Context parentCtx context.Context
isTLS bool isTLS bool
rtspAddress string rtspAddress string
readTimeout conf.StringDuration readTimeout conf.Duration
writeTimeout conf.StringDuration writeTimeout conf.Duration
runOnConnect string runOnConnect string
runOnConnectRestart bool runOnConnectRestart bool
runOnDisconnect string runOnDisconnect string

View File

@@ -64,8 +64,8 @@ type serverParent interface {
// Server is a RTMP server. // Server is a RTMP server.
type Server struct { type Server struct {
Address string Address string
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
WriteTimeout conf.StringDuration WriteTimeout conf.Duration
IsTLS bool IsTLS bool
ServerCert string ServerCert string
ServerKey string ServerKey string

View File

@@ -109,8 +109,8 @@ func TestServerPublish(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:1935", Address: "127.0.0.1:1935",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
IsTLS: encrypt == "tls", IsTLS: encrypt == "tls",
ServerCert: serverCertFpath, ServerCert: serverCertFpath,
ServerKey: serverKeyFpath, ServerKey: serverKeyFpath,
@@ -220,8 +220,8 @@ func TestServerRead(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:1935", Address: "127.0.0.1:1935",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
IsTLS: encrypt == "tls", IsTLS: encrypt == "tls",
ServerCert: serverCertFpath, ServerCert: serverCertFpath,
ServerKey: serverKeyFpath, ServerKey: serverKeyFpath,

View File

@@ -32,7 +32,7 @@ type conn struct {
isTLS bool isTLS bool
rtspAddress string rtspAddress string
authMethods []rtspauth.ValidateMethod authMethods []rtspauth.ValidateMethod
readTimeout conf.StringDuration readTimeout conf.Duration
runOnConnect string runOnConnect string
runOnConnectRestart bool runOnConnectRestart bool
runOnDisconnect string runOnDisconnect string

View File

@@ -61,8 +61,8 @@ type serverParent interface {
type Server struct { type Server struct {
Address string Address string
AuthMethods []auth.ValidateMethod AuthMethods []auth.ValidateMethod
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
WriteTimeout conf.StringDuration WriteTimeout conf.Duration
WriteQueueSize int WriteQueueSize int
UseUDP bool UseUDP bool
UseMulticast bool UseMulticast bool

View File

@@ -94,8 +94,8 @@ func TestServerPublish(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:8557", Address: "127.0.0.1:8557",
AuthMethods: []auth.ValidateMethod{auth.ValidateMethodBasic}, AuthMethods: []auth.ValidateMethod{auth.ValidateMethodBasic},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
WriteQueueSize: 512, WriteQueueSize: 512,
UseUDP: false, UseUDP: false,
UseMulticast: false, UseMulticast: false,
@@ -188,8 +188,8 @@ func TestServerRead(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:8557", Address: "127.0.0.1:8557",
AuthMethods: []auth.ValidateMethod{auth.ValidateMethodBasic}, AuthMethods: []auth.ValidateMethod{auth.ValidateMethodBasic},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
WriteQueueSize: 512, WriteQueueSize: 512,
UseUDP: false, UseUDP: false,
UseMulticast: false, UseMulticast: false,

View File

@@ -51,8 +51,8 @@ const (
type conn struct { type conn struct {
parentCtx context.Context parentCtx context.Context
rtspAddress string rtspAddress string
readTimeout conf.StringDuration readTimeout conf.Duration
writeTimeout conf.StringDuration writeTimeout conf.Duration
udpMaxPayloadSize int udpMaxPayloadSize int
connReq srt.ConnRequest connReq srt.ConnRequest
runOnConnect string runOnConnect string

View File

@@ -67,8 +67,8 @@ type serverParent interface {
type Server struct { type Server struct {
Address string Address string
RTSPAddress string RTSPAddress string
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
WriteTimeout conf.StringDuration WriteTimeout conf.Duration
UDPMaxPayloadSize int UDPMaxPayloadSize int
RunOnConnect string RunOnConnect string
RunOnConnectRestart bool RunOnConnectRestart bool

View File

@@ -91,8 +91,8 @@ func TestServerPublish(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:8890", Address: "127.0.0.1:8890",
RTSPAddress: "", RTSPAddress: "",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
UDPMaxPayloadSize: 1472, UDPMaxPayloadSize: 1472,
RunOnConnect: "", RunOnConnect: "",
RunOnConnectRestart: false, RunOnConnectRestart: false,
@@ -192,8 +192,8 @@ func TestServerRead(t *testing.T) {
s := &Server{ s := &Server{
Address: "127.0.0.1:8890", Address: "127.0.0.1:8890",
RTSPAddress: "", RTSPAddress: "",
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
UDPMaxPayloadSize: 1472, UDPMaxPayloadSize: 1472,
RunOnConnect: "", RunOnConnect: "",
RunOnConnectRestart: false, RunOnConnectRestart: false,

View File

@@ -79,7 +79,7 @@ type httpServer struct {
serverCert string serverCert string
allowOrigin string allowOrigin string
trustedProxies conf.IPNetworks trustedProxies conf.IPNetworks
readTimeout conf.StringDuration readTimeout conf.Duration
pathManager serverPathManager pathManager serverPathManager
parent *Server parent *Server

View File

@@ -181,15 +181,15 @@ type Server struct {
ServerCert string ServerCert string
AllowOrigin string AllowOrigin string
TrustedProxies conf.IPNetworks TrustedProxies conf.IPNetworks
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
LocalUDPAddress string LocalUDPAddress string
LocalTCPAddress string LocalTCPAddress string
IPsFromInterfaces bool IPsFromInterfaces bool
IPsFromInterfacesList []string IPsFromInterfacesList []string
AdditionalHosts []string AdditionalHosts []string
ICEServers []conf.WebRTCICEServer ICEServers []conf.WebRTCICEServer
HandshakeTimeout conf.StringDuration HandshakeTimeout conf.Duration
TrackGatherTimeout conf.StringDuration TrackGatherTimeout conf.Duration
ExternalCmdPool *externalcmd.Pool ExternalCmdPool *externalcmd.Pool
PathManager serverPathManager PathManager serverPathManager
Parent serverParent Parent serverParent

View File

@@ -108,15 +108,15 @@ func initializeTestServer(t *testing.T) *Server {
ServerCert: "", ServerCert: "",
AllowOrigin: "*", AllowOrigin: "*",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
LocalUDPAddress: "127.0.0.1:8887", LocalUDPAddress: "127.0.0.1:8887",
LocalTCPAddress: "127.0.0.1:8887", LocalTCPAddress: "127.0.0.1:8887",
IPsFromInterfaces: true, IPsFromInterfaces: true,
IPsFromInterfacesList: []string{}, IPsFromInterfacesList: []string{},
AdditionalHosts: []string{}, AdditionalHosts: []string{},
ICEServers: []conf.WebRTCICEServer{}, ICEServers: []conf.WebRTCICEServer{},
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
ExternalCmdPool: nil, ExternalCmdPool: nil,
PathManager: pm, PathManager: pm,
Parent: test.NilLogger, Parent: test.NilLogger,
@@ -192,7 +192,7 @@ func TestServerOptionsICEServer(t *testing.T) {
ServerCert: "", ServerCert: "",
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
LocalUDPAddress: "127.0.0.1:8887", LocalUDPAddress: "127.0.0.1:8887",
LocalTCPAddress: "127.0.0.1:8887", LocalTCPAddress: "127.0.0.1:8887",
IPsFromInterfaces: true, IPsFromInterfaces: true,
@@ -203,8 +203,8 @@ func TestServerOptionsICEServer(t *testing.T) {
Username: "myuser", Username: "myuser",
Password: "mypass", Password: "mypass",
}}, }},
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
ExternalCmdPool: nil, ExternalCmdPool: nil,
PathManager: pathManager, PathManager: pathManager,
Parent: test.NilLogger, Parent: test.NilLogger,
@@ -260,15 +260,15 @@ func TestServerPublish(t *testing.T) {
ServerCert: "", ServerCert: "",
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
LocalUDPAddress: "127.0.0.1:8887", LocalUDPAddress: "127.0.0.1:8887",
LocalTCPAddress: "127.0.0.1:8887", LocalTCPAddress: "127.0.0.1:8887",
IPsFromInterfaces: true, IPsFromInterfaces: true,
IPsFromInterfacesList: []string{}, IPsFromInterfacesList: []string{},
AdditionalHosts: []string{}, AdditionalHosts: []string{},
ICEServers: []conf.WebRTCICEServer{}, ICEServers: []conf.WebRTCICEServer{},
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
ExternalCmdPool: nil, ExternalCmdPool: nil,
PathManager: pathManager, PathManager: pathManager,
Parent: test.NilLogger, Parent: test.NilLogger,
@@ -541,15 +541,15 @@ func TestServerRead(t *testing.T) {
ServerCert: "", ServerCert: "",
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
LocalUDPAddress: "127.0.0.1:8887", LocalUDPAddress: "127.0.0.1:8887",
LocalTCPAddress: "127.0.0.1:8887", LocalTCPAddress: "127.0.0.1:8887",
IPsFromInterfaces: true, IPsFromInterfaces: true,
IPsFromInterfacesList: []string{}, IPsFromInterfacesList: []string{},
AdditionalHosts: []string{}, AdditionalHosts: []string{},
ICEServers: []conf.WebRTCICEServer{}, ICEServers: []conf.WebRTCICEServer{},
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
ExternalCmdPool: nil, ExternalCmdPool: nil,
PathManager: pathManager, PathManager: pathManager,
Parent: test.NilLogger, Parent: test.NilLogger,
@@ -629,15 +629,15 @@ func TestServerReadNotFound(t *testing.T) {
ServerCert: "", ServerCert: "",
AllowOrigin: "", AllowOrigin: "",
TrustedProxies: conf.IPNetworks{}, TrustedProxies: conf.IPNetworks{},
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
LocalUDPAddress: "127.0.0.1:8887", LocalUDPAddress: "127.0.0.1:8887",
LocalTCPAddress: "127.0.0.1:8887", LocalTCPAddress: "127.0.0.1:8887",
IPsFromInterfaces: true, IPsFromInterfaces: true,
IPsFromInterfacesList: []string{}, IPsFromInterfacesList: []string{},
AdditionalHosts: []string{}, AdditionalHosts: []string{},
ICEServers: []conf.WebRTCICEServer{}, ICEServers: []conf.WebRTCICEServer{},
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
ExternalCmdPool: nil, ExternalCmdPool: nil,
PathManager: pm, PathManager: pm,
Parent: test.NilLogger, Parent: test.NilLogger,

View File

@@ -18,7 +18,7 @@ import (
// Source is a HLS static source. // Source is a HLS static source.
type Source struct { type Source struct {
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
Parent defs.StaticSourceParent Parent defs.StaticSourceParent
} }

View File

@@ -21,8 +21,8 @@ import (
// Source is a RTMP static source. // Source is a RTMP static source.
type Source struct { type Source struct {
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
WriteTimeout conf.StringDuration WriteTimeout conf.Duration
Parent defs.StaticSourceParent Parent defs.StaticSourceParent
} }

View File

@@ -67,8 +67,8 @@ func TestSource(t *testing.T) {
te = test.NewSourceTester( te = test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
Parent: p, Parent: p,
} }
}, },
@@ -79,8 +79,8 @@ func TestSource(t *testing.T) {
te = test.NewSourceTester( te = test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
Parent: p, Parent: p,
} }
}, },

View File

@@ -62,8 +62,8 @@ func createRangeHeader(cnf *conf.Path) (*headers.Range, error) {
// Source is a RTSP static source. // Source is a RTSP static source.
type Source struct { type Source struct {
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
WriteTimeout conf.StringDuration WriteTimeout conf.Duration
WriteQueueSize int WriteQueueSize int
Parent defs.StaticSourceParent Parent defs.StaticSourceParent
} }

View File

@@ -138,8 +138,8 @@ func TestSource(t *testing.T) {
te = test.NewSourceTester( te = test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
WriteQueueSize: 2048, WriteQueueSize: 2048,
Parent: p, Parent: p,
} }
@@ -153,8 +153,8 @@ func TestSource(t *testing.T) {
te = test.NewSourceTester( te = test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
WriteQueueSize: 2048, WriteQueueSize: 2048,
Parent: p, Parent: p,
} }
@@ -241,8 +241,8 @@ func TestRTSPSourceNoPassword(t *testing.T) {
te := test.NewSourceTester( te := test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
WriteQueueSize: 2048, WriteQueueSize: 2048,
Parent: p, Parent: p,
} }
@@ -338,8 +338,8 @@ func TestRTSPSourceRange(t *testing.T) {
te := test.NewSourceTester( te := test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
WriteTimeout: conf.StringDuration(10 * time.Second), WriteTimeout: conf.Duration(10 * time.Second),
WriteQueueSize: 2048, WriteQueueSize: 2048,
Parent: p, Parent: p,
} }

View File

@@ -17,7 +17,7 @@ import (
// Source is a SRT static source. // Source is a SRT static source.
type Source struct { type Source struct {
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
Parent defs.StaticSourceParent Parent defs.StaticSourceParent
} }

View File

@@ -54,7 +54,7 @@ func TestSource(t *testing.T) {
te := test.NewSourceTester( te := test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Parent: p, Parent: p,
} }
}, },

View File

@@ -45,7 +45,7 @@ type packetConn interface {
// Source is a UDP static source. // Source is a UDP static source.
type Source struct { type Source struct {
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
Parent defs.StaticSourceParent Parent defs.StaticSourceParent
} }

View File

@@ -18,7 +18,7 @@ func TestSource(t *testing.T) {
te := test.NewSourceTester( te := test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Parent: p, Parent: p,
} }
}, },

View File

@@ -20,7 +20,7 @@ import (
// Source is a WebRTC static source. // Source is a WebRTC static source.
type Source struct { type Source struct {
ReadTimeout conf.StringDuration ReadTimeout conf.Duration
Parent defs.StaticSourceParent Parent defs.StaticSourceParent
} }

View File

@@ -39,8 +39,8 @@ func TestSource(t *testing.T) {
LocalRandomUDP: true, LocalRandomUDP: true,
IPsFromInterfaces: true, IPsFromInterfaces: true,
Publish: true, Publish: true,
HandshakeTimeout: conf.StringDuration(10 * time.Second), HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second), TrackGatherTimeout: conf.Duration(2 * time.Second),
OutgoingTracks: outgoingTracks, OutgoingTracks: outgoingTracks,
Log: test.NilLogger, Log: test.NilLogger,
} }
@@ -125,7 +125,7 @@ func TestSource(t *testing.T) {
te := test.NewSourceTester( te := test.NewSourceTester(
func(p defs.StaticSourceParent) defs.StaticSource { func(p defs.StaticSourceParent) defs.StaticSource {
return &Source{ return &Source{
ReadTimeout: conf.StringDuration(10 * time.Second), ReadTimeout: conf.Duration(10 * time.Second),
Parent: p, Parent: p,
} }
}, },

View File

@@ -469,7 +469,7 @@ pathDefaults:
recordSegmentDuration: 1h recordSegmentDuration: 1h
# Delete segments after this timespan. # Delete segments after this timespan.
# Set to 0s to disable automatic deletion. # Set to 0s to disable automatic deletion.
recordDeleteAfter: 24h recordDeleteAfter: 1d
############################################### ###############################################
# Default path settings -> Publisher source (when source is "publisher") # Default path settings -> Publisher source (when source is "publisher")