Revert "enable runOnDemandRestart by default (#3605)" (#3609)

This reverts commit 547e56e82b.
This commit is contained in:
Alessandro Ros 2024-08-04 12:32:37 +02:00 committed by GitHub
parent c80bb53b0f
commit aade940296
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 3 deletions

View File

@ -1428,6 +1428,7 @@ Edit `mediamtx.yml` and replace everything inside section `paths` with the follo
paths:
ondemand:
runOnDemand: ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
runOnDemandRestart: yes
```
The command inserted into `runOnDemand` will start only when a client requests the path `ondemand`, therefore the file will start streaming only when requested.
@ -1587,6 +1588,8 @@ pathDefaults:
# * G1, G2, ...: regular expression groups, if path name is
# a regular expression.
runOnDemand: ffmpeg -i my_file.mp4 -c copy -f rtsp rtsp://localhost:8554/mypath
# Restart the command if it exits.
runOnDemandRestart: no
```
`runOnUnDemand` allows to run a command when there are no readers anymore:

View File

@ -77,7 +77,6 @@ func TestConfFromFile(t *testing.T) {
RPICameraAfRange: "normal",
RPICameraAfSpeed: "normal",
RPICameraTextOverlay: "%Y-%m-%d %H:%M:%S - MediaMTX",
RunOnDemandRestart: true,
RunOnDemandStartTimeout: 5 * StringDuration(time.Second),
RunOnDemandCloseAfter: 10 * StringDuration(time.Second),
}, pa)

View File

@ -220,7 +220,6 @@ func (pconf *Path) setDefaults() {
pconf.RPICameraTextOverlay = "%Y-%m-%d %H:%M:%S - MediaMTX"
// Hooks
pconf.RunOnDemandRestart = true
pconf.RunOnDemandStartTimeout = 10 * StringDuration(time.Second)
pconf.RunOnDemandCloseAfter = 10 * StringDuration(time.Second)
}

View File

@ -615,7 +615,7 @@ pathDefaults:
# a regular expression.
runOnDemand:
# Restart the command if it exits.
runOnDemandRestart: yes
runOnDemandRestart: no
# Readers will be put on hold until the runOnDemand command starts publishing
# or until this amount of time has passed.
runOnDemandStartTimeout: 10s