Files
zoneminder/src
Isaac Connor b2b50aba5d perf: skip clearPackets early-returns and allow drop-to-iterator-keyframe
Two related changes to PacketQueue::clearPackets, called by the analysis
thread on every video packet:

1. Lock-free call-site gate (should_try_clear) on the analysis path.
   In keep_keyframes mode the existing early-return at the top of
   clearPackets discards most non-keyframe video packets after acquiring
   the queue mutex. Add an inline lock-free check at the call site so
   non-keyframe packets skip the mutex acquire entirely. clear_packets_pending_
   is now std::atomic<bool> so it can be read without the lock; a stale
   read is harmless (at worst we make one extra cheap early-returning call).
   The !keep_keyframes path always returns true from the gate because that
   mode pops one packet at a time on every video packet.

2. Iterator boundary in the scan loop changed from >= to >. Setting
   next_front to a packet that an iterator points at is safe because
   clearPackets deletes strictly before next_front, so the iterator's
   own packet stays in the queue. Previously, an event-start (or other)
   iterator landing exactly on a keyframe blocked the leading GOP from
   being dropped until the iterator advanced; now we can include that
   keyframe as next_front while the iterator continues to point at it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 19:39:04 -04:00
..
2013-03-17 00:45:21 +01:00
2024-10-26 14:29:40 -04:00
2024-03-26 13:43:58 -05:00
2024-10-26 14:29:40 -04:00
2025-07-05 08:09:09 -04:00
2021-05-30 21:41:58 +02:00
2026-01-29 18:50:42 -05:00
2024-10-29 13:30:29 -04:00
2025-02-26 21:04:32 +11:00
2025-02-26 21:04:32 +11:00
2025-09-18 10:07:50 -04:00
2023-01-18 16:01:42 -05:00
2025-07-05 08:09:09 -04:00
2025-07-05 08:09:09 -04:00
2026-01-05 16:36:36 -05:00
2026-01-05 16:36:36 -05:00