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
..
2024-03-26 13:43:58 -05:00
2026-02-26 08:02:26 -05:00
2013-03-17 00:45:21 +01:00
2026-02-04 20:44:17 -05:00
2024-10-26 14:29:40 -04:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-02-02 20:34:33 -05:00
2026-03-29 09:52:00 -04:00
2026-03-29 09:52:00 -04:00
2026-02-03 10:18:49 -05:00
2026-02-02 20:44:01 -05:00
2026-02-23 18:19:20 -05:00
2026-02-03 10:18:49 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2021-06-06 19:11:11 +02:00
2021-05-30 22:56:21 +02:00
2021-05-30 22:56:21 +02:00
2026-02-03 10:18:49 -05:00
2024-03-26 13:43:58 -05:00
2026-02-04 20:44:17 -05:00
2024-10-26 14:29:40 -04:00
2021-05-16 16:42:58 +02:00
2026-02-03 10:18:49 -05:00
2025-07-05 08:09:09 -04:00
2026-04-14 20:57:46 -04:00
2026-02-12 23:00:59 -05:00
2026-03-05 02:15:08 +00:00
2026-02-11 04:20:55 +00:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-04-15 15:58:44 -04:00
2026-01-26 14:40:10 -05:00
2026-03-06 12:33:25 -05:00
2025-09-22 09:52:25 -04:00
2026-02-03 11:03:17 -05:00
2024-03-26 13:43:58 -05:00
2026-02-05 09:08:02 -05:00
2026-01-26 14:40:10 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-02-03 11:36:53 -05:00
2024-03-26 13:43:58 -05:00
2026-02-02 23:24:08 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2021-05-30 21:41:58 +02:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-03-09 15:07:14 -04:00
2026-03-09 15:07:14 -04:00
2026-02-03 11:42:14 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-04-09 09:33:52 -04:00
2026-02-07 22:32:56 -05:00
2025-07-19 14:18:32 -04:00
2025-07-19 14:18:32 -04:00
2026-02-03 11:49:58 -05:00
2024-03-26 13:43:58 -05:00
2026-02-03 12:09:44 -05:00
2024-03-26 13:43:58 -05:00
2021-05-16 19:41:45 +02:00
2026-04-07 20:48:57 -04:00
2026-01-29 18:50:42 -05:00
2026-02-23 18:19:20 -05:00
2026-02-23 18:19:20 -05:00
2024-03-26 13:43:58 -05:00
2026-03-05 02:13:59 +00:00
2026-03-05 02:13:59 +00:00
2026-03-05 02:13:59 +00:00
2026-04-07 20:48:42 -04:00
2026-04-28 21:36:49 -04:00
2026-02-09 11:34:44 -05:00
2026-03-09 15:07:14 -04:00
2026-03-09 15:07:14 -04:00
2026-03-05 02:13:59 +00:00
2026-04-29 19:39:04 -04:00
2026-03-05 02:41:06 +00:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-04-18 09:53:23 -04:00
2024-03-26 13:43:58 -05:00
2026-03-05 02:15:08 +00:00
2026-03-05 02:15:08 +00:00
2026-02-02 20:53:00 -05:00
2024-10-29 13:30:29 -04:00
2026-02-07 23:41:48 -05:00
2026-02-15 15:38:07 -05:00
2026-04-29 19:39:04 -04:00
2026-04-29 19:39:04 -04:00
2026-02-03 12:13:29 -05:00
2022-01-06 16:45:15 -06:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2025-02-26 21:04:32 +11:00
2025-02-26 21:04:32 +11:00
2026-02-04 17:41:37 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-09-14 11:06:55 +10:00
2024-03-26 13:43:58 -05:00
2026-02-03 12:25:21 -05:00
2024-03-26 13:43:58 -05:00
2025-09-18 10:07:50 -04:00
2026-02-03 12:34:21 -05:00
2024-03-26 13:43:58 -05:00
2026-02-03 12:45:56 -05:00
2024-03-26 13:43:58 -05:00
2026-02-03 12:47:14 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-01-09 11:43:15 -05:00
2026-01-05 13:36:16 +00:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-01-31 12:43:03 -05:00
2026-01-31 16:19:38 -05:00
2026-01-31 16:19:38 -05:00
2026-01-30 15:30:40 -05:00
2024-03-26 13:43:58 -05:00
2026-01-30 14:49:53 -05:00
2026-01-30 14:49:53 -05:00
2024-03-26 13:43:58 -05:00
2026-01-31 12:43:03 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-04-19 23:06:36 -04:00
2026-02-03 12:28:30 -05:00
2024-03-26 13:43:58 -05:00
2026-02-03 13:34:17 -05:00
2024-03-26 13:43:58 -05:00
2023-01-18 16:01:42 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-04-18 09:53:23 -04:00
2026-04-18 09:53:23 -04:00
2026-02-03 12:30:06 -05:00
2024-03-26 13:43:58 -05:00
2026-03-05 02:15:08 +00:00
2026-02-23 18:19:20 -05:00
2026-02-03 16:47:43 -05:00
2024-03-26 13:43:58 -05:00
2025-07-05 08:09:09 -04:00
2025-07-05 08:09:09 -04:00
2026-02-12 16:53:39 -05:00
2026-02-12 16:53:39 -05:00
2024-03-26 13:43:58 -05:00
2024-03-26 13:43:58 -05:00
2026-03-09 15:07:14 -04:00
2026-03-09 15:07:14 -04:00
2026-02-04 20:45:46 -05:00
2026-02-15 15:38:07 -05:00
2024-03-26 13:43:58 -05:00
2026-04-14 20:57:46 -04:00
2026-04-14 20:57:46 -04:00
2026-02-07 22:52:15 -05:00
2026-03-09 17:16:56 -04:00
2026-02-12 18:06:56 -05:00
2026-01-05 16:36:36 -05:00
2026-01-05 16:36:36 -05:00
2026-03-04 09:23:38 -05:00
2024-03-26 13:43:58 -05:00
2026-04-10 08:40:26 -04:00
2026-04-18 09:53:23 -04:00
2025-12-31 22:29:37 +11:00