mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-09 20:02:01 -08:00
record: prevent recordDeleteAfter from deleting current segment (#4331)
This commit is contained in:
parent
3d16cf40b4
commit
b64650ca4a
3 changed files with 14 additions and 2 deletions
|
|
@ -423,6 +423,14 @@ func TestConfErrors(t *testing.T) {
|
|||
" recordPath: invalid\n",
|
||||
`record path 'invalid' is missing one of the mandatory elements: %path %Y %m %d %H %M %S %f`,
|
||||
},
|
||||
{
|
||||
"invalid record delete after",
|
||||
"paths:\n" +
|
||||
" my_path:\n" +
|
||||
" recordSegmentDuration: 30m\n" +
|
||||
" recordDeleteAfter: 20m\n",
|
||||
`'recordDeleteAfter' cannot be lower than 'recordSegmentDuration'`,
|
||||
},
|
||||
} {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
tmpf, err := createTempFile([]byte(ca.conf))
|
||||
|
|
|
|||
|
|
@ -512,6 +512,10 @@ func (pconf *Path) validate(
|
|||
return fmt.Errorf("maximum segment duration is 1 day")
|
||||
}
|
||||
|
||||
if pconf.RecordDeleteAfter != 0 && pconf.RecordDeleteAfter < pconf.RecordSegmentDuration {
|
||||
return fmt.Errorf("'recordDeleteAfter' cannot be lower than 'recordSegmentDuration'")
|
||||
}
|
||||
|
||||
// Authentication (deprecated)
|
||||
|
||||
if deprecatedCredentialsMode {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue