Skip to content

perf(recording): finalize and validate audio alongside the video remux - #2589

Merged
richiemcilroy merged 2 commits into
mainfrom
perf/finalize-audio-overlap
Oct 15, 2026
Merged

richiemcilroy merged 2 commits into
mainfrom
perf/finalize-audio-overlap

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

After Stop, finalization remuxes the fragmented recording into progressive files and validates every track. Each audio track was fully decoded twice: the input fragments before the remux, then the output file after it. Both decodes ran one after another and after the video concat, so on macOS the Instant share link waited for all of it (finalize_with_publication → finalize_staged). The GPUI app and the CLI both go through this path.

gantt
  dateFormat X
  axisFormat %L ms
  section main (Instant 600 s)
  input audio validation :a1, 0, 470
  video concat + validation :a2, after a1, 530
  audio concat + merge :a3, after a2, 230
  output audio validation :a4, after a3, 520
  section this PR
  video concat + validation :b1, 0, 530
  audio validation + concat :b2, 0, 520
  merge :b3, after b1, 190
  output audio + merged video validation :b4, after b3, 520
Loading
  • Instant (crates/recording/src/recovery.rs): input audio validation and the audio concat run on a scoped thread while the video concat runs. The final audio check runs alongside the merged-video check. Its result is reused only when that check didn't rewrite the file.
  • Studio: per segment, audio finalize and its output validation run alongside the display/camera concat (finalize_segment_video / finalize_segment_audio). The mic and system-audio input validations run in parallel (validate_recovered_audio_in_order).
  • Every check still runs on the same files. When more than one track fails, the error returned is the first in the original track order. If a thread can't be spawned, the work runs serially as before. The new threads get 16 MiB stacks.
  • Every finalized file in the bundle is byte-identical to main, apart from publication-receipt.json, which hashes mtimes and inodes and differs between two main runs too.

Benchmark

Finalize wall time (M4 Max, interleaved A/B, median [range]):

Fixture main This PR Change
Studio 60 s (mic + system audio + camera) 477 [434-499] ms 392 [384-428] ms −18%
Studio 180 s 1571 [1426-1863] ms 1371 [1263-1719] ms −13%
Instant 600 s 2158 [1909-2443] ms 1481 [1341-1621] ms −31%
main This PR
Instructions (Studio 180 s) 24.205e9 24.197e9
Instructions (Instant 600 s) 22.941e9 22.883e9
Peak footprint (Studio 180 s) 139.9 MB 139.8 MB
Peak footprint (Instant 600 s) 104.8 MB 106.3 MB

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the earlier open-file problem is fixed and no new blocking issues were found.

Summary

The PR runs audio finalization and checks alongside video work. The latest change fixes the earlier open-file finding.

  • Instant recordings finalize audio while video work runs.
  • Studio segments finish audio work alongside video.
  • Recovered audio tracks are checked in parallel without changing error order.

Reviews (2) · Last reviewed commit: "fix(recording): join the Instant audio c..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cap-status Ready Ready Preview Oct 14, 2026 7:04pm UTC

Comment thread crates/recording/src/recovery.rs Outdated
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot 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.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@richiemcilroy
richiemcilroy merged commit 73928ff into main Oct 15, 2026
33 checks passed
@richiemcilroy
richiemcilroy deleted the perf/finalize-audio-overlap branch October 15, 2026 02:35

This branch was successfully deployed

2 active deployments
Preview – cap-web — d2a46639 Deployed Oct 14, 2026 by vercel[bot]
Preview – cap-status — d2a46639 Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant