Make saving preview frames on restart more reliable (#10630)

* increase priority of saving preview frames

* Improve checking for ended recording
This commit is contained in:
Nicolas Mowen 2024-03-23 13:45:15 -06:00 committed by GitHub
parent 3a9607e59b
commit c2a32bd6c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -130,6 +130,8 @@ def output_frames(
previous_frames[camera] = frame_time previous_frames[camera] = frame_time
move_preview_frames("clips")
while True: while True:
(topic, data) = detection_subscriber.get_data(timeout=0) (topic, data) = detection_subscriber.get_data(timeout=0)
@ -156,8 +158,6 @@ def output_frames(
for preview in preview_recorders.values(): for preview in preview_recorders.values():
preview.stop() preview.stop()
move_preview_frames("clips")
if birdseye is not None: if birdseye is not None:
birdseye.stop() birdseye.stop()

View File

@ -7,6 +7,7 @@ import os
import random import random
import string import string
import threading import threading
import time
from collections import defaultdict from collections import defaultdict
from multiprocessing.synchronize import Event as MpEvent from multiprocessing.synchronize import Event as MpEvent
from pathlib import Path from pathlib import Path
@ -440,7 +441,12 @@ class RecordingMaintainer(threading.Thread):
def run(self) -> None: def run(self) -> None:
# Check for new files every 5 seconds # Check for new files every 5 seconds
wait_time = 0.0 wait_time = 0.0
while not self.stop_event.wait(wait_time): while not self.stop_event.is_set():
time.sleep(wait_time)
if self.stop_event.is_set():
break
run_start = datetime.datetime.now().timestamp() run_start = datetime.datetime.now().timestamp()
# check if there is an updated config # check if there is an updated config