Skip to content

perf(recording): bound camera & converter frame queues by byte budget and drain macOS autorelease pools (#109) - #3935

Open
frds3445 wants to merge 6 commits into
CapSoftware:mainfrom
frds3445:perf/issue-109-recording-memory-bounds
Open

frds3445 wants to merge 6 commits into
CapSoftware:mainfrom
frds3445:perf/issue-109-recording-memory-bounds

Conversation

@frds3445

@frds3445 frds3445 commented Nov 7, 2026 •

Copy link
Copy Markdown

Summary

Bounds in-flight camera and frame-converter queues by explicit byte budgets and drains macOS Objective-C autorelease pools per frame during recording (#109):

  • Wraps per-frame CoreMedia/CVPixelBuffer callbacks and VideoToolbox conversion passes in crates/camera/src/macos.rs and crates/frame-converter/src/videotoolbox.rs in explicit autorelease pool drains to avoid retaining transient Objective-C buffers across long sessions.
  • Enforces bounded byte budgets on converter and camera frame queues in crates/frame-converter/src/pool.rs and crates/recording/src/sources/camera.rs.

Fixes #109
/claim #109

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues remain.

Summary

This PR limits memory held by camera and converter queues, bounds timing samples, and adds macOS buffer cleanup and reuse.

  • Camera recordings size their frame queue to the frames they hold.
  • Frame conversion keeps its workers and queues within a byte budget.
  • macOS camera operations drain temporary Objective-C objects more often.
  • VideoToolbox conversions reuse an output pixel buffer.
  • Recording benchmarks keep only recent timing samples.
  • CPU and memory reports keep showing the same measurements.

Reviews (8) · Last reviewed commit: "fix(frame-converter): reject conversions..." · Reviewed by Greptile

… and drain macOS autorelease pools

Fixes CapSoftware#109

Signed-off-by: Lucas Oliveira <kalopsia3445@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 7, 2026 15:50
@vercel

vercel Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

@frds3445 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Comment thread crates/recording/src/sources/camera.rs Resolved
Comment thread crates/frame-converter/src/pool.rs Resolved
Comment thread crates/frame-converter/src/pool.rs Resolved
Comment thread crates/frame-converter/src/pool.rs Resolved
…rop narrating comments

Include worker_count in bounded_for_conversion retained byte accounting, allow 1-frame camera channel bounds for ultra-high-res formats, and remove narrating comments per AGENTS.md.
@richiemcilroy

Copy link
Copy Markdown
Member

Thanks @frds3445, this looks like a useful change.

Before we can merge it:

  • Greptile is at 2/5 on an earlier commit; it needs 5/5 on the latest one.

Once that's sorted, request a re-review from Greptile.

Comment thread crates/frame-converter/src/pool.rs Resolved
Comment thread crates/frame-converter/src/pool.rs Resolved
@frds3445

frds3445 commented Nov 8, 2026 •

Copy link
Copy Markdown
Author

Thanks @richiemcilroy, sorted that out and re-ran Greptile on the latest commit (d35f41b), it is at 5/5 now.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce CPU / memory usage whilst recording

3 participants