mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-24 23:44:43 +03:00
only cache preview frames when recording is enabled
The segment-end check tested the record config object instead of record.enabled, and the first frame after startup was written unconditionally. With recording disabled, the first segment still cached frames and encoded a preview.
This commit is contained in:
@@ -392,18 +392,20 @@ class PreviewRecorder:
|
|||||||
) -> None:
|
) -> None:
|
||||||
self.offline = False
|
self.offline = False
|
||||||
|
|
||||||
# always write the first frame
|
|
||||||
if self.start_time == 0:
|
if self.start_time == 0:
|
||||||
self.start_time = frame_time
|
self.start_time = frame_time
|
||||||
|
|
||||||
|
if self.config.record.enabled:
|
||||||
self.output_frames.append(frame_time)
|
self.output_frames.append(frame_time)
|
||||||
self.write_frame_to_cache(frame_time, frame)
|
self.write_frame_to_cache(frame_time, frame)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# check if PREVIEW clip should be generated and cached frames reset
|
# check if PREVIEW clip should be generated and cached frames reset
|
||||||
if frame_time >= self.segment_end:
|
if frame_time >= self.segment_end:
|
||||||
if len(self.output_frames) > 0:
|
if len(self.output_frames) > 0:
|
||||||
# save last frame to ensure consistent duration
|
# save last frame to ensure consistent duration
|
||||||
if self.config.record:
|
if self.config.record.enabled:
|
||||||
self.output_frames.append(frame_time)
|
self.output_frames.append(frame_time)
|
||||||
self.write_frame_to_cache(frame_time, frame)
|
self.write_frame_to_cache(frame_time, frame)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user