Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Merge main into perf/avassetreader-idle-retain

Richie McIlroy8e6320d2c4fd
diff --cc crates/rendering/src/decoder/avassetreader.rs
index 059330dc5,b3b1114e3..7982571cf
--- a/crates/rendering/src/decoder/avassetreader.rs
+++ b/crates/rendering/src/decoder/avassetreader.rs
@@@ -45,12 -45,8 +45,13 @@@ const SEQUENTIAL_FRAME_CACHE_SIZE: usiz
// Paused recordings can contain hundreds of screen/camera pairs. AVAssetReader
// starts decoding eagerly, so only requested tracks may hold native readers.
const MAX_ACTIVE_READERS: usize = 16;
-const IDLE_READER_TIMEOUT: Duration = Duration::from_millis(250);
+// An idle reader keeps its native reader, cache and warm-ahead frames for
+// IDLE_READER_RETAIN, so a hover or Play shortly after a pause continues
+// from them. It releases them sooner, at the next IDLE_READER_POLL, when every
+// reader permit is taken and another track may be waiting for one.
+const IDLE_READER_POLL: Duration = Duration::from_millis(250);
+const IDLE_READER_RETAIN: Duration = Duration::from_secs(5);
+ const MAX_CACHED_FRAMES_BELOW_REQUEST: u32 = 10;
fn reader_capacity() -> &'static Arc<Semaphore> {
static CAPACITY: OnceLock<Arc<Semaphore>> = OnceLock::new();