mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix shared memory frames being stuck when a camera capture crashed (#14140)
* Fix shared memory frames being stuck when a camera capture crashed * Update ffmpeg build
This commit is contained in:
parent
b9e74ee9ab
commit
e725730982
@ -44,7 +44,7 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then
|
||||
wget -qO btbn-ffmpeg.tar.xz "https://github.com/NickM-27/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linux64-gpl-5.1.tar.xz"
|
||||
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/5.0 --strip-components 1
|
||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/5.0/doc /usr/lib/ffmpeg/5.0/bin/ffplay
|
||||
wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-19-12-51/ffmpeg-n7.0.2-18-g3e6cec1286-linux64-gpl-7.0.tar.xz"
|
||||
wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-30-15-36/ffmpeg-n7.1-linux64-gpl-7.1.tar.xz"
|
||||
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/7.0 --strip-components 1
|
||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/7.0/doc /usr/lib/ffmpeg/7.0/bin/ffplay
|
||||
fi
|
||||
@ -56,7 +56,7 @@ if [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||
wget -qO btbn-ffmpeg.tar.xz "https://github.com/NickM-27/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linuxarm64-gpl-5.1.tar.xz"
|
||||
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/5.0 --strip-components 1
|
||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/5.0/doc /usr/lib/ffmpeg/5.0/bin/ffplay
|
||||
wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-19-12-51/ffmpeg-n7.0.2-18-g3e6cec1286-linuxarm64-gpl-7.0.tar.xz"
|
||||
wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-30-15-36/ffmpeg-n7.1-linuxarm64-gpl-7.1.tar.xz"
|
||||
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/7.0 --strip-components 1
|
||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/7.0/doc /usr/lib/ffmpeg/7.0/bin/ffplay
|
||||
fi
|
||||
|
@ -94,6 +94,7 @@ def capture_frames(
|
||||
ffmpeg_process,
|
||||
config: CameraConfig,
|
||||
shm_frame_count: int,
|
||||
shm_frames: list[str],
|
||||
frame_shape,
|
||||
frame_manager: FrameManager,
|
||||
frame_queue,
|
||||
@ -108,8 +109,6 @@ def capture_frames(
|
||||
skipped_eps = EventsPerSecond()
|
||||
skipped_eps.start()
|
||||
|
||||
shm_frames: list[str] = []
|
||||
|
||||
while True:
|
||||
fps.value = frame_rate.eps()
|
||||
skipped_fps.value = skipped_eps.eps()
|
||||
@ -154,10 +153,6 @@ def capture_frames(
|
||||
# if the queue is full, skip this frame
|
||||
skipped_eps.update()
|
||||
|
||||
# clear out frames
|
||||
for frame in shm_frames:
|
||||
frame_manager.delete(frame)
|
||||
|
||||
|
||||
class CameraWatchdog(threading.Thread):
|
||||
def __init__(
|
||||
@ -176,6 +171,7 @@ class CameraWatchdog(threading.Thread):
|
||||
self.camera_name = camera_name
|
||||
self.config = config
|
||||
self.shm_frame_count = shm_frame_count
|
||||
self.shm_frames: list[str] = []
|
||||
self.capture_thread = None
|
||||
self.ffmpeg_detect_process = None
|
||||
self.logpipe = LogPipe(f"ffmpeg.{self.camera_name}.detect")
|
||||
@ -308,6 +304,7 @@ class CameraWatchdog(threading.Thread):
|
||||
self.capture_thread = CameraCapture(
|
||||
self.config,
|
||||
self.shm_frame_count,
|
||||
self.shm_frames,
|
||||
self.ffmpeg_detect_process,
|
||||
self.frame_shape,
|
||||
self.frame_queue,
|
||||
@ -348,6 +345,7 @@ class CameraCapture(threading.Thread):
|
||||
self,
|
||||
config: CameraConfig,
|
||||
shm_frame_count: int,
|
||||
shm_frames: list[str],
|
||||
ffmpeg_process,
|
||||
frame_shape,
|
||||
frame_queue,
|
||||
@ -359,6 +357,7 @@ class CameraCapture(threading.Thread):
|
||||
self.name = f"capture:{config.name}"
|
||||
self.config = config
|
||||
self.shm_frame_count = shm_frame_count
|
||||
self.shm_frames = shm_frames
|
||||
self.frame_shape = frame_shape
|
||||
self.frame_queue = frame_queue
|
||||
self.fps = fps
|
||||
@ -374,6 +373,7 @@ class CameraCapture(threading.Thread):
|
||||
self.ffmpeg_process,
|
||||
self.config,
|
||||
self.shm_frame_count,
|
||||
self.shm_frames,
|
||||
self.frame_shape,
|
||||
self.frame_manager,
|
||||
self.frame_queue,
|
||||
|
Loading…
Reference in New Issue
Block a user