Prevent concurrent RTSP recording on the same camera.

Reserve camera ownership under registry lock before spawning ffmpeg, return 409 for conflicts without retry, and transcode slices to 1080p H.264 for more stable playback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
op
2026-05-26 16:32:55 +08:00
parent 32c1c3ac75
commit 3979e13ca9
12 changed files with 314 additions and 56 deletions

View File

@@ -22,6 +22,7 @@
- 停录时 flush 尾切片并等待 batch 队列 drain`RTSP_SLICE_BATCH_DRAIN_TIMEOUT_SEC`)。
- 落盘切片默认 **24 小时**后自动删除(`RTSP_SEGMENT_TTL_HOURS`;进程启动与后台定时 sweep
- 设置 `RTSP_RECORD_ALL_CAMERAS=true` 可对请求中所有可解析 RTSP 的机位分别录像+跑 batch多机位代码已预留
- **同一机位同时只允许一场手术录制**(默认主摄 `RTSP_PRIMARY_CAMERA_ID`):另一场次开录同一 camera 时返回 `409` / `CAMERA_ALREADY_RECORDING`;注册表在拉起 ffmpeg 前即占用机位,避免双路 RTSP 抢流导致录像周期性丢帧。
## Docker 与 RTSP 地址