mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-09-27 03:56:15 +08:00
record: prevent recordDeleteAfter from deleting current segment (#4331)
This commit is contained in:
@@ -553,7 +553,7 @@ This web page can be embedded into another web page by using an iframe:
|
||||
<iframe src="http://mediamtx-ip:8889/mystream/publish" scrolling="no"></iframe>
|
||||
```
|
||||
|
||||
For more advanced setups, you can create and serve a custom web page by starting from the [source code of the WebRTC publish page](internal/servers/webrtc/publish_index.html).
|
||||
For more advanced setups, you can create and serve a custom web page by starting from the [source code of the WebRTC publish page](internal/servers/webrtc/publish_index.html). In particular, there's a ready-to-use, standalone JavaScript class for publishing streams with WebRTC, available in [publisher.js](internal/servers/webrtc/publisher.js).
|
||||
|
||||
### By device
|
||||
|
||||
@@ -1104,7 +1104,7 @@ This web page can be embedded into another web page by using an iframe:
|
||||
<iframe src="http://mediamtx-ip:8889/mystream" scrolling="no"></iframe>
|
||||
```
|
||||
|
||||
For more advanced setups, you can create and serve a custom web page by starting from the [source code of the WebRTC read page](internal/servers/webrtc/read_index.html).
|
||||
For more advanced setups, you can create and serve a custom web page by starting from the [source code of the WebRTC read page](internal/servers/webrtc/read_index.html). In particular, there's a ready-to-use, standalone JavaScript class for reading streams with WebRTC, available in [reader.js](internal/servers/webrtc/reader.js).
|
||||
|
||||
Web browsers can also read a stream with the [HLS protocol](#hls). Latency is higher but there are less problems related to connectivity between server and clients, furthermore the server load can be balanced by using a common HTTP CDN (like CloudFront or Cloudflare), and this allows to handle readers in the order of millions. Visit the web page:
|
||||
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user