Skip to content

fix(export): route Windows auto through native GPU planner#504

Draft
meiiie wants to merge 10 commits into
webadderallorg:mainfrom
meiiie:codex/nvidia-lightning-route
Draft

fix(export): route Windows auto through native GPU planner#504
meiiie wants to merge 10 commits into
webadderallorg:mainfrom
meiiie:codex/nvidia-lightning-route

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 12, 2026

Description

Routes Windows Lightning auto exports through an explicit native planner so visually compatible projects try the native static layout path before Breeze/WebCodecs. The planner now makes CUDA/NVENC, Windows D3D11, and FFmpeg fallback decisions explicit, logs why each route was selected or rejected, and keeps CUDA behind the existing output validation gate.

This update also refreshes the bundled NVIDIA CUDA compositor helper with higher-quality NV12 resampling for scaled content/webcam overlays. That addresses the visible blocky/noisy output we saw in CUDA exports without forcing CUDA for projects that still need WebGL/WebCodecs parity.

Motivation

After PR #410 landed, Windows auto exports could still route into Breeze/WebCodecs before the native CUDA/D3D11 static compositor had a chance to run. That made NVIDIA-capable machines look like they had lost the native path. Separately, the CUDA compositor was fast but its nearest-neighbor style scaling made some screen recordings look visibly degraded. This PR makes routing deterministic and observable, then improves the native compositor quality where it is allowed to run.

Changes Made

  • Add renderer-side Lightning route planning for Windows auto exports.
  • Try native static layout first when the project is visually eligible; keep Breeze/WebCodecs fallback intact.
  • Add main-process native route planning for:
    • nvidia-cuda-compositor
    • windows-d3d11-compositor
    • ffmpeg-static-layout
  • Log CUDA wrapper path, dev/package mode, NVIDIA probe result, source codec/proxy state, D3D11 helper/adapter settings, encoder backend, timings, diagnostics paths, and fallback reasons.
  • Keep CUDA validation-gated by output frame/duration/timestamp checks before it can win.
  • Rebuild the bundled NVIDIA compositor helper and manifest after replacing point sampling with cubic/bilinear NV12 sampling for scaled content and webcam overlays.
  • Keep embedded source audio separate from mic sidecars so fallback audio routing does not duplicate system audio.
  • Restore fail-closed pruning when a saved project cannot be parsed, protecting recordings from accidental cleanup.
  • Stabilize the native fallback smoke test import path.

Scope / Safety Notes

  • This is still a Windows beta/lab path, not a broad release claim for every NVIDIA machine.
  • CUDA Toolkit is not required for testers/users. It is only needed on a developer machine that rebuilds the helper. Runtime eligibility is a supported NVIDIA GPU/driver/NVENC path plus passing validation.
  • D3D11 and FFmpeg remain ordered fallbacks. WebCodecs/Breeze still handles projects outside native static-layout parity.
  • Known non-goals for this PR: dynamic/caption/annotation overlays and other editor features that still require WebGL/WebCodecs parity unless separately validated.

Beta Test Branch

beta/windows-nvidia-cuda-export-lab points at the same commit for external tester pulls.

Suggested tester run:

git fetch origin beta/windows-nvidia-cuda-export-lab
git checkout beta/windows-nvidia-cuda-export-lab
git pull
npm install
npm run dev

For dev-lab CUDA testing:

scripts/launch-recordly-cuda-auto.ps1 -CloseExisting -ForceVideoOnly

Diagnostics are written under:

  • packaged/prod: %APPDATA%\Recordly\native-export-diagnostics
  • dev: %APPDATA%\Recordly-dev\native-export-diagnostics

Validation

  • npm test (70 files, 611 tests)
  • npx tsc --noEmit --pretty false
  • npm run smoke:electron-main-cjs
  • npm run build:nvidia-cuda-compositor
  • npx vite build --config vite.config.ts
  • Post-build npm run smoke:electron-main-cjs
  • Scoped Biome lint rules on changed TS files with formatter disabled locally; full formatter check is blocked on this Windows checkout by core.autocrlf=true converting files to CRLF while repo config expects LF.
  • Windows NVIDIA smoke with generated H.264 input + webcam overlay selected nvidia-cuda-compositor, output 90 frames / 3.00s, native helper measured about 274 FPS.
  • Manual long-project lab export selected nvidia-cuda-compositor; video/audio duration diff was about 0.006s.

Checklist

  • Main is current: branch is based on origin/main 7bc06c9 (v1.3.0-beta.2).
  • Fallback behavior is preserved.
  • CUDA remains validation-gated.
  • Diagnostics explain selected and rejected routes.
  • Bundled NVIDIA helper manifest matches the rebuilt helper.
  • Independent NVIDIA tester confirmation on non-lab hardware.
  • CodeRabbit review after moving out of draft.

Summary by CodeRabbit

  • New Features
    • GPU-accelerated Windows exports with NVIDIA CUDA probing, D3D11 fallback, adapter selection, and NVENC controls.
  • Improvements
    • Smarter export routing with ordered route plans and richer structured logging and verification.
    • Improved NV12 video resampling for smoother scaling and overlays.
    • Native audio planning now resolves and threads source-fallback audio paths into native exports.
  • Bug Fixes
    • Fail-fast on unreadable saved project files during pruning.
    • Prefer microphone companion audio when recordings include embedded audio.
  • Tests / Chores
    • Expanded GPU/audio export tests and added a dev helper script for NVIDIA CUDA development.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 10b6c3e4-188c-4e6e-9970-a9f48933fa86

📥 Commits

Reviewing files that changed from the base of the PR and between 12c0911 and ef90dc6.

📒 Files selected for processing (2)
  • electron/ipc/export/native-video.test.ts
  • electron/ipc/export/native-video.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • electron/ipc/export/native-video.ts

📝 Walkthrough

Walkthrough

Adds structured route planning and capability probes for native static-layout exports, integrates the plan into export execution and ModernVideoExporter, threads resolved source-audio fallback paths, hardens project prune error handling and tests, and replaces integer NV12 sampling with mapped-float cubic/bilinear resampling in the CUDA compositor.

Changes

Export Routing and Native Static-Layout Integration

Layer / File(s) Summary
Route planning types and decision helpers
src/lib/exporter/backendPolicy.ts, src/lib/exporter/backendPolicy.test.ts
Adds LightningExportRoute, LightningExportRouteDecision, LightningExportRoutePlan, shouldPreferNativeStaticLayoutBeforeBreeze, and planLightningExportRoutes to compute structured backend routing decisions.
CUDA & Windows D3D11 capability probes
electron/ipc/export/native-video.ts
Adds Windows-only env controls, probe types, env-parsing helpers, and implements probeExperimentalNvidiaCudaExportCapability, Windows D3D11 probe, and planNativeStaticLayoutRoutes.
Native export execution with route plan & fallback
electron/ipc/export/native-video.ts
Computes nativeRoutePlan in exportNativeStaticLayoutVideo, gates CUDA/D3D11 execution from the plan, logs structured plan/warnings, updates fallbackReason on runtime failures, verifies fallback output, and records extended metrics.
ModernVideoExporter: routing, deferral & audio threading
src/lib/exporter/modernVideoExporter.ts, src/lib/exporter/modernVideoExporter.*
Imports planner/preference helpers, defers native encoder start when preferNativeStaticLayoutBeforeBreeze applies, logs Lightning route plans before native static-layout attempts, and threads resolved sourceAudioFallbackPaths through NativeAudioPlan and rendering flows.
Audio fallback, tests, and project prune behavior
src/lib/exporter/audioEncoder.test.ts, electron/ipc/recording/diagnostics.ts, electron/ipc/recording/prune.ts, src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
Updates OfflineRenderTestHarness usage (mainBufferEntry + gain), filters companion audio fallback candidates to only microphone when embedded audio exists, makes saved-project read/parse failures abort pruning (rethrow), and adds/adjusts tests for source-audio fallback behavior.
Native static-layout tests & native-video checks
electron/ipc/export/native-video.test.ts
Primes mocks (fs access, GPU info) for CUDA tests, adds CUDA-wrapper-unavailable test, validates Windows GPU adapter selection flags and adapter-index override, and adds audio-muxing / canCopyAudioCodecIntoMp4 tests.
Dev script
scripts/dev-nvidia-cuda.mjs, package.json
Adds dev:nvidia-cuda script and a launcher that sets CUDA/NVENC env and spawns the dev process with exit/signal handling.

CUDA Compositor Pixel Quality Improvements

Layer / File(s) Summary
Floating-point sampling device helpers
electron/native/nvidia-cuda-compositor/src/main.cu
Adds mapScaledCoordinate, bilinear plane sampling, cubic luma sampling, and NV12 UV bilinear sampling device helpers with clamping and edge handling.
Kernel updates with mapped-float resampling
electron/native/nvidia-cuda-compositor/src/main.cu
Updates copyNv12Kernel, content overlay/transform kernels, composite static kernels, and webcam overlay kernels to use mapped float coordinates and cubic/bilinear resampling for luma and chroma.
CUDA compositor binary manifest update
electron/native/bin/win32-x64/helpers-manifest.json
Bumps recordly-nvidia-cuda-compositor helper binarySha256, sourceFingerprint, and updatedAt to match rebuilt binary.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

Checked

Poem

🐰 I skitter through plans and mapped coordinates,

Cubic luma hums while tests tidy the gates,
Adapters checked, fallback paths sewn tight,
A rebuilt helper gleams in the night,
Hooray — the exporter hops to new heights.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling Windows auto exports to route through a native GPU planner before falling back to Breeze/WebCodecs.
Description check ✅ Passed The description is comprehensive and well-structured. It covers purpose, motivation, specific changes made, safety scope notes, validation steps performed, and a clear testing guide.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@meiiie meiiie changed the title [codex] Route Windows Lightning exports through NVIDIA native planner pref: Route Windows Lightning exports through NVIDIA native planner May 12, 2026
@meiiie meiiie changed the title pref: Route Windows Lightning exports through NVIDIA native planner fix(export): route Windows auto through native GPU planner May 12, 2026
@meiiie
Copy link
Copy Markdown
Collaborator Author

meiiie commented May 12, 2026

@coderabbitai review

Ready for another review pass on the latest head f1ddcf3.

Context for this pass:

  • Added the Windows native route planner so Lightning/auto can try native static layout before Breeze/WebCodecs when visually eligible.
  • Rebuilt the NVIDIA CUDA compositor helper and manifest after improving NV12 scaling quality for content/webcam overlays.
  • Kept CUDA validation-gated and preserved D3D11/FFmpeg/WebCodecs fallbacks.
  • Added/updated safety around embedded audio fallback routing and fail-closed recording prune behavior.

Local validation on this head:

  • npm test (70 files, 611 tests)
  • npx tsc --noEmit --pretty false
  • npm run smoke:electron-main-cjs
  • npm run build:nvidia-cuda-compositor
  • npx vite build --config vite.config.ts
  • post-build npm run smoke:electron-main-cjs
  • Windows NVIDIA smoke with generated H.264 input + webcam overlay selected nvidia-cuda-compositor and produced 90 frames / 3.00s.

Please focus especially on native route selection/fallback safety, CUDA helper validation assumptions, and any risk from the bundled helper/manifest update.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

@meiiie — Kicking off a review pass on head f1ddcf3. I'll pay particular attention to:

  1. Native route selection/fallback safety — ordering guarantees, eligibility checks, and whether Breeze/WebCodecs fallback can be reached from all failure paths.
  2. CUDA helper validation assumptions — frame/duration/timestamp gate correctness and edge cases (zero-duration, mismatched frame counts, etc.).
  3. Bundled helper/manifest update risks — manifest hash/size consistency with the rebuilt binary and any path-resolution differences between dev and packaged modes.

Focus areas: native route selection/fallback safety, CUDA helper validation assumptions, and risks from the bundled NVIDIA compositor helper/manifest update. The Windows Lightning auto route planner routes native static layout before Breeze/WebCodecs; CUDA remains validation-gated; D3D11/FFmpeg/WebCodecs fallbacks are preserved; embedded audio fallback routing and fail-closed recording prune safety were also updated.

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/exporter/audioEncoder.test.ts (1)

60-61: ⚡ Quick win

Consider validating companion entry gain for completeness.

The test now validates mainBufferEntry.gain (line 59), but the companion entry gain field introduced in the type definition (line 18) is not tested here. For consistency and to ensure the new gain field works correctly for companion audio, consider adding an assertion.

🧪 Suggested test enhancement
 expect(prepared.companionEntries).toHaveLength(1);
 expect(prepared.companionEntries[0]?.buffer).toBe(micBuffer);
+expect(prepared.companionEntries[0]?.gain).toBe(1);
 expect(decodeAudioFromUrl).toHaveBeenCalledWith("file:///tmp/recording.mp4");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/exporter/audioEncoder.test.ts` around lines 60 - 61, Add an assertion
that validates the companion entry's gain — e.g.,
expect(prepared.companionEntries[0]?.gain).toBe(prepared.mainBufferEntry.gain)
(or toBe(the expected mic gain value used earlier like micGain) depending on how
the test defines expected gain) so the test covers the newly introduced
companion gain field on prepared.companionEntries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@electron/ipc/export/native-video.ts`:
- Line 3674: The change sets videoOutputValidated = true inside the GPU success
paths which prevents the later ffprobe-based check in
validateNativeVideoOutputFile() from running; revert that premature flip by
removing or deferring any assignment to the videoOutputValidated flag (the
variable named videoOutputValidated) inside the GPU success branches (the
CUDA/D3D11 success handlers) and only set videoOutputValidated = true after
validateNativeVideoOutputFile() returns success — keep the independent probe
call intact and ensure the GPU paths call validateNativeVideoOutputFile() (or
await its result) and set videoOutputValidated afterwards.

In `@electron/native/nvidia-cuda-compositor/src/main.cu`:
- Around line 1032-1043: The caller is passing x+1/y+1 into mapScaledCoordinate
which shifts the UV sample off the 2x2 luma-block center expected by
sampleNv12UvBilinear; remove the +1 offsets and pass the luma coordinates that
represent the block center (i.e., use x and y as the inputs to
mapScaledCoordinate) so suvX/suvY match sampleNv12UvBilinear's lumaX/lumaY
contract, and make the same change in the other occurrence (the block around
sampleNv12UvBilinear at ~1197-1202).

---

Nitpick comments:
In `@src/lib/exporter/audioEncoder.test.ts`:
- Around line 60-61: Add an assertion that validates the companion entry's gain
— e.g.,
expect(prepared.companionEntries[0]?.gain).toBe(prepared.mainBufferEntry.gain)
(or toBe(the expected mic gain value used earlier like micGain) depending on how
the test defines expected gain) so the test covers the newly introduced
companion gain field on prepared.companionEntries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ee03bf86-9eca-48b4-a4d4-07cfa067e316

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc06c9 and f1ddcf3.

⛔ Files ignored due to path filters (1)
  • electron/native/bin/win32-x64/recordly-nvidia-cuda-compositor.exe is excluded by !**/*.exe
📒 Files selected for processing (11)
  • electron/ipc/export/native-video.test.ts
  • electron/ipc/export/native-video.ts
  • electron/ipc/recording/diagnostics.ts
  • electron/ipc/recording/prune.ts
  • electron/native/bin/win32-x64/helpers-manifest.json
  • electron/native/nvidia-cuda-compositor/src/main.cu
  • src/lib/exporter/audioEncoder.test.ts
  • src/lib/exporter/backendPolicy.test.ts
  • src/lib/exporter/backendPolicy.ts
  • src/lib/exporter/modernVideoExporter.fallback.test.ts
  • src/lib/exporter/modernVideoExporter.ts

Comment thread electron/ipc/export/native-video.ts Outdated
Comment thread electron/native/nvidia-cuda-compositor/src/main.cu Outdated
@meiiie
Copy link
Copy Markdown
Collaborator Author

meiiie commented May 12, 2026

@coderabbitai review

Ready for a follow-up review pass on latest head 4e0e126.

Addressed the previous CodeRabbit feedback:

  • Removed premature videoOutputValidated = true in CUDA/D3D11 success branches so the shared ffprobe validation still runs before native output is marked validated.
  • Corrected the flagged CUDA NV12 UV sampling offsets in the copy/rect kernels.
  • Added companion audio gain coverage in audioEncoder.test.ts.
  • Rebuilt recordly-nvidia-cuda-compositor.exe and updated the helper manifest.

Validation on this head:

  • npm test (70 files, 611 tests)
  • npx tsc --noEmit --pretty false
  • npm run build:nvidia-cuda-compositor
  • npm run smoke:electron-main-cjs
  • npx vite build --config vite.config.ts
  • post-build npm run smoke:electron-main-cjs
  • Windows NVIDIA smoke with generated H.264 input + webcam overlay selected nvidia-cuda-compositor and produced 90 frames / 3.00s.

Please re-check the native validation flow, CUDA sampling fix, and helper/manifest update on this latest head.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

@meiiie — Kicking off a follow-up review pass on head 4e0e126. I'll specifically re-check:

  1. Native validation flow — confirming videoOutputValidated is no longer set prematurely in the CUDA/D3D11 success branches and that the shared ffprobe validation gate runs correctly before marking output as validated.
  2. CUDA NV12 UV sampling offsets — verifying the corrected offsets in the copy/rect kernels are consistent across all affected kernel paths.
  3. Helper/manifest update — cross-checking the rebuilt recordly-nvidia-cuda-compositor.exe SHA-256 and fingerprint against the updated helpers-manifest.json entries.
✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@electron/ipc/export/native-video.test.ts`:
- Around line 707-726: The test relies on ambient
RECORDLY_WINDOWS_GPU_EXPORT_PREFER_HIGH_PERFORMANCE_ADAPTER which can make it
flaky; inside the test before calling
buildExperimentalWindowsGpuStaticLayoutArgs (and alongside the existing handling
for RECORDLY_WINDOWS_GPU_EXPORT_ADAPTER_INDEX), save and then explicitly set
process.env.RECORDLY_WINDOWS_GPU_EXPORT_PREFER_HIGH_PERFORMANCE_ADAPTER to a
known value (e.g., "1" or delete it) so the assertion is deterministic, then
restore the original value in the finally block; update the try/finally to
capture originalPrefer =
process.env.RECORDLY_WINDOWS_GPU_EXPORT_PREFER_HIGH_PERFORMANCE_ADAPTER, set the
env to the intended test value, run the assertions against
buildExperimentalWindowsGpuStaticLayoutArgs, and in finally restore
process.env.RECORDLY_WINDOWS_GPU_EXPORT_PREFER_HIGH_PERFORMANCE_ADAPTER to
originalPrefer (deleting if undefined).

In `@electron/ipc/export/native-video.ts`:
- Around line 2099-2102: The probe incorrectly uses packagedAutoCandidateEnabled
when deciding audio bypass eligibility; replace that with
packagedAutoCandidateActive so only when the packaged auto-candidate is actually
active we allow the validated-fallback behavior. Update the call to
getNvidiaCudaAudioExportSkipReason(audioMode, { allowValidatedFallbackCandidate:
... }) to pass packagedAutoCandidateActive (together with
isNvidiaCudaForceVideoOnlyEnabled() as before) instead of
packagedAutoCandidateEnabled so copy-source audio in a packaged build isn’t
wrongly marked eligible unless the auto-candidate is active.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2d9ce027-3535-4e8a-85ff-e07f1ccbe565

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc06c9 and 4e0e126.

⛔ Files ignored due to path filters (1)
  • electron/native/bin/win32-x64/recordly-nvidia-cuda-compositor.exe is excluded by !**/*.exe
📒 Files selected for processing (11)
  • electron/ipc/export/native-video.test.ts
  • electron/ipc/export/native-video.ts
  • electron/ipc/recording/diagnostics.ts
  • electron/ipc/recording/prune.ts
  • electron/native/bin/win32-x64/helpers-manifest.json
  • electron/native/nvidia-cuda-compositor/src/main.cu
  • src/lib/exporter/audioEncoder.test.ts
  • src/lib/exporter/backendPolicy.test.ts
  • src/lib/exporter/backendPolicy.ts
  • src/lib/exporter/modernVideoExporter.fallback.test.ts
  • src/lib/exporter/modernVideoExporter.ts

Comment thread electron/ipc/export/native-video.test.ts
Comment thread electron/ipc/export/native-video.ts
@meiiie
Copy link
Copy Markdown
Collaborator Author

meiiie commented May 12, 2026

@coderabbitai review

Follow-up fixes pushed in latest head f8f4fda for the two new review comments:

  • probeExperimentalNvidiaCudaExportCapability now uses packagedAutoCandidateActive for validated fallback audio eligibility instead of only checking whether the package auto-candidate feature is enabled.
  • The D3D11 high-performance-adapter test now controls and restores RECORDLY_WINDOWS_GPU_EXPORT_PREFER_HIGH_PERFORMANCE_ADAPTER, so it is deterministic even with ambient env vars.

Validation:

  • npm test -- electron/ipc/export/native-video.test.ts (68 tests)
  • npx tsc --noEmit --pretty false
  • npx biome check --formatter-enabled=false electron/ipc/export/native-video.ts electron/ipc/export/native-video.test.ts

Please re-check these two review points on f8f4fda.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

@meiiie — Kicking off a targeted review pass on head f8f4fda. I'll specifically re-check:

  1. probeExperimentalNvidiaCudaExportCapability fallback audio eligibility — confirming packagedAutoCandidateActive is now used (rather than just the feature-enabled flag) to gate validated fallback audio, and that the condition correctly reflects the active auto-candidate state.
  2. D3D11 high-performance-adapter test determinism — verifying that RECORDLY_WINDOWS_GPU_EXPORT_PREFER_HIGH_PERFORMANCE_ADAPTER is properly set before the assertion and restored in finally, so the test result is independent of any ambient environment variable state.
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@meiiie meiiie closed this May 12, 2026
@meiiie meiiie deleted the codex/nvidia-lightning-route branch May 12, 2026 20:33
@meiiie meiiie restored the codex/nvidia-lightning-route branch May 12, 2026 20:35
@meiiie meiiie reopened this May 12, 2026
@meiiie
Copy link
Copy Markdown
Collaborator Author

meiiie commented May 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
electron/ipc/export/native-video.ts (1)

3644-3661: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Require an audio stream before treating CUDA output as fully muxed.

When shouldMuxAudioInline is true, this path later skips the shared mux step and returns the CUDA file after only validating the video stream. The current checks never fail if the helper drops the audio stream entirely, so a silent MP4 can ship here without fallback.

Suggested check
 						const cudaValidationIssues = validateNvidiaCudaExportSummary(
 							cudaResult.summary,
 							{
 								durationSec: options.durationSec,
 								targetFrames: Math.ceil(options.durationSec * options.frameRate),
 								requiresTimelineSync: shouldMuxAudioInline,
 							},
 						);
+						if (shouldMuxAudioInline) {
+							const renderedMetadata = await probeNativeVideoMetadata(
+								ffmpegPath,
+								videoOnlyPath,
+							);
+							if (!renderedMetadata.hasAudio) {
+								cudaValidationIssues.push("missing output audio stream");
+							}
+						}
 						if (cudaValidationIssues.length > 0) {

Also applies to: 3718-3718, 4036-4042

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron/ipc/export/native-video.ts` around lines 3644 - 3661, When
shouldMuxAudioInline is true we must ensure the CUDA export actually includes an
audio stream before treating it as fully muxed: after calling
runExperimentalNvidiaCudaStaticLayoutExport and before skipping the shared mux
step, check cudaResult.summary (or call validateNvidiaCudaExportSummary with an
added audio-required flag) to assert an audio stream is present and non-empty;
if audio is missing, fail validation (throw or return an error) so the
fallback/mux path runs. Update validateNvidiaCudaExportSummary (or add an
explicit check immediately after runExperimentalNvidiaCudaStaticLayoutExport) to
inspect cudaResult.summary.audioTracks or similar field and require at least one
valid audio track when shouldMuxAudioInline / requiresTimelineSync is true.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@electron/ipc/export/native-video.ts`:
- Around line 3644-3661: When shouldMuxAudioInline is true we must ensure the
CUDA export actually includes an audio stream before treating it as fully muxed:
after calling runExperimentalNvidiaCudaStaticLayoutExport and before skipping
the shared mux step, check cudaResult.summary (or call
validateNvidiaCudaExportSummary with an added audio-required flag) to assert an
audio stream is present and non-empty; if audio is missing, fail validation
(throw or return an error) so the fallback/mux path runs. Update
validateNvidiaCudaExportSummary (or add an explicit check immediately after
runExperimentalNvidiaCudaStaticLayoutExport) to inspect
cudaResult.summary.audioTracks or similar field and require at least one valid
audio track when shouldMuxAudioInline / requiresTimelineSync is true.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 86cf00ec-3e4c-4526-b51d-32e54cbea040

📥 Commits

Reviewing files that changed from the base of the PR and between f8f4fda and 12c0911.

📒 Files selected for processing (6)
  • electron/ipc/export/native-video.test.ts
  • electron/ipc/export/native-video.ts
  • package.json
  • scripts/dev-nvidia-cuda.mjs
  • src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
  • src/lib/exporter/modernVideoExporter.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/exporter/modernVideoExporter.ts

@meiiie
Copy link
Copy Markdown
Collaborator Author

meiiie commented May 14, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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