You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -243,9 +244,32 @@ function stop_ffmpeg_graceful_async() {
243
244
echo"$(date -u +"${ts_format}") [${process_name}] - [Session: ${session_id_param}] FFmpeg graceful stop initiated in background (PID: ${bg_pid}) for file: ${video_file_name_param}"
244
245
}
245
246
247
+
functionensure_minimum_recording_duration() {
248
+
# Ensure recording has run for minimum duration to avoid corrupted files
249
+
# IMPORTANT: recording_started must remain "true" during this function
250
+
# to prevent new sessions from starting (checked at line ~406)
251
+
252
+
if [[ -n"${recording_start_time}" ]];then
253
+
local current_time=$(date +%s)
254
+
local recording_duration=$((current_time - recording_start_time))
255
+
256
+
if [[ ${recording_duration}-lt${min_recording_duration} ]];then
257
+
local wait_time=$((min_recording_duration - recording_duration))
258
+
echo"$(date -u +"${ts_format}") [${process_name}] - [Session: ${prev_session_id}] Recording duration ${recording_duration}s is less than minimum ${min_recording_duration}s, waiting ${wait_time}s more (new sessions blocked)"
259
+
sleep ${wait_time}
260
+
echo"$(date -u +"${ts_format}") [${process_name}] - [Session: ${prev_session_id}] Minimum recording duration ${min_recording_duration}s reached, new sessions can start"
0 commit comments