mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-12 16:16:42 +03:00
Compare commits
2 Commits
63c9be1f82
...
62e3887745
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62e3887745 | ||
|
|
8d71d8be4a |
@ -124,6 +124,7 @@ def capture_frames(
|
|||||||
config_subscriber.check_for_updates()
|
config_subscriber.check_for_updates()
|
||||||
return config.enabled
|
return config.enabled
|
||||||
|
|
||||||
|
try:
|
||||||
while not stop_event.is_set():
|
while not stop_event.is_set():
|
||||||
if not get_enabled_state():
|
if not get_enabled_state():
|
||||||
logger.debug(f"Stopping capture thread for disabled {config.name}")
|
logger.debug(f"Stopping capture thread for disabled {config.name}")
|
||||||
@ -141,7 +142,9 @@ def capture_frames(
|
|||||||
if stop_event.is_set():
|
if stop_event.is_set():
|
||||||
break
|
break
|
||||||
|
|
||||||
logger.error(f"{config.name}: Unable to read frames from ffmpeg process.")
|
logger.error(
|
||||||
|
f"{config.name}: Unable to read frames from ffmpeg process."
|
||||||
|
)
|
||||||
|
|
||||||
if ffmpeg_process.poll() is not None:
|
if ffmpeg_process.poll() is not None:
|
||||||
logger.error(
|
logger.error(
|
||||||
@ -163,6 +166,8 @@ def capture_frames(
|
|||||||
skipped_eps.update()
|
skipped_eps.update()
|
||||||
|
|
||||||
frame_index = 0 if frame_index == shm_frame_count - 1 else frame_index + 1
|
frame_index = 0 if frame_index == shm_frame_count - 1 else frame_index + 1
|
||||||
|
finally:
|
||||||
|
config_subscriber.stop()
|
||||||
|
|
||||||
|
|
||||||
class CameraWatchdog(threading.Thread):
|
class CameraWatchdog(threading.Thread):
|
||||||
@ -234,6 +239,16 @@ class CameraWatchdog(threading.Thread):
|
|||||||
else:
|
else:
|
||||||
self.ffmpeg_detect_process.wait()
|
self.ffmpeg_detect_process.wait()
|
||||||
|
|
||||||
|
# Wait for old capture thread to fully exit before starting a new one
|
||||||
|
if self.capture_thread is not None and self.capture_thread.is_alive():
|
||||||
|
self.logger.info("Waiting for capture thread to exit...")
|
||||||
|
self.capture_thread.join(timeout=5)
|
||||||
|
|
||||||
|
if self.capture_thread.is_alive():
|
||||||
|
self.logger.warning(
|
||||||
|
f"Capture thread for {self.config.name} did not exit in time"
|
||||||
|
)
|
||||||
|
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"The following ffmpeg logs include the last 100 lines prior to exit."
|
"The following ffmpeg logs include the last 100 lines prior to exit."
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user