Skip to content

feat(export): add NVIDIA opt-in detection#562

Merged
meiiie merged 2 commits into
mainfrom
feature/nvidia-export-opt-in
May 22, 2026
Merged

feat(export): add NVIDIA opt-in detection#562
meiiie merged 2 commits into
mainfrom
feature/nvidia-export-opt-in

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 22, 2026

Summary

  • Add a main-process native export capability probe for NVIDIA CUDA availability.
  • Surface an experimental NVIDIA CUDA switch in the MP4 Lightning export menu only when this Windows device reports a usable NVIDIA path.
  • Require user opt-in before packaged/user-facing CUDA candidates run, while preserving the explicit lab env path for RECORDLY_EXPERIMENTAL_NVIDIA_CUDA_EXPORT=1.

Why

This carries forward the NVIDIA research from #504 without merging the broad draft branch. Users should not silently enter an experimental CUDA path just because the app is packaged; the app should detect the device, show an explicit opt-in, and continue to rely on the existing validation/fallback chain.

Platform Scope

  • This PR intentionally enables the NVIDIA CUDA opt-in only for Windows because the current Recordly CUDA helper is packaged as a Windows .exe and the export route still falls back through the Windows GPU compositor.
  • Linux NVIDIA/CUDA/NVENC is supported by NVIDIA at the platform level, but Recordly does not currently package or validate a Linux CUDA compositor helper in this slice.
  • A future Linux NVIDIA PR should be separate and must add Linux helper packaging, Linux capability probing, packaged-app smoke coverage, and real-device QA before exposing any Linux UI switch.

References Checked

Safety Notes

  • No CUDA source, binary, helper manifest, or dev launcher changes in this PR.
  • The switch is runtime/app-local, not saved into project files or presets.
  • If CUDA is opted in and audio is present, the native path uses the shared mux validation guard instead of trusting inline audio.
  • Explicit lab env usage is preserved for developer testing.

Verification

  • npm test -- electron/ipc/export/native-video.test.ts
  • npm test -- src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
  • npx tsc --noEmit
  • npx biome check --formatter-enabled=false electron/ipc/export/native-video.ts electron/ipc/export/native-video.test.ts electron/ipc/register/export.ts electron/preload.ts electron/electron-env.d.ts src/lib/exporter/types.ts src/lib/exporter/modernVideoExporter.ts src/components/video-editor/ExportSettingsMenu.tsx src/components/video-editor/VideoEditor.tsx
  • git diff --check
  • npx vite build --config vite.config.ts
  • npm run smoke:electron-main-cjs

Not Run

  • npm run smoke:packaged-binaries because this checkout does not currently have a packaged release/app.asar.unpacked directory.

Related to #504.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

Adds an experimental NVIDIA CUDA native export path with user opt‑in, runtime capability probing via getNativeExportCapabilities(), refactors GPU probe behavior, updates skip‑reason/timeout logic, wires IPC/preload/exporter/UI, and adds tests.

Changes

NVIDIA CUDA Export Capability with User Opt-In

Layer / File(s) Summary
Capability types and API contracts
electron/electron-env.d.ts, electron/preload.ts, src/lib/exporter/types.ts
Declares renderer/preload/exporter capability types and exposes getNativeExportCapabilities(); extends nativeStaticLayoutExport and ExportConfig with experimentalNvidiaCudaExport option.
Native NVIDIA CUDA capability detection and eligibility refactor
electron/ipc/export/native-video.ts
Refactors GPU probing to return null when probe unavailable; adds getNativeExportCapabilities() that checks wrapper/GPU inspectability; replaces packaged-auto-candidate semantics with explicit env and user experimentalNvidiaCudaExport opt-in; updates validated-fallback helpers, audio mux validation, stall timeout selection, and skip-logging metadata.
IPC handler registration
electron/ipc/register/export.ts
Registers get-native-export-capabilities IPC handler that returns structured success/error responses from getNativeExportCapabilities().
Export pipeline integration
src/lib/exporter/modernVideoExporter.ts
ModernVideoExporter forwards experimentalNvidiaCudaExport flag into nativeStaticLayoutExport.
VideoEditor capability detection and export decision logic
src/components/video-editor/VideoEditor.tsx
Adds persisted opt-in state, queries getNativeExportCapabilities() on mount to set availability and auto-disables when unsupported, persists opt-in changes, forces modern pipeline on enable, and computes useExperimentalNvidiaCudaExport for MP4 export.
ExportSettingsMenu UI component
src/components/video-editor/ExportSettingsMenu.tsx
Adds experimentalNvidiaCudaExport, onExperimentalNvidiaCudaExportChange, and nvidiaCudaExportAvailable props with defaults; conditionally renders MP4-only CUDA toggle when available.
Test coverage
electron/ipc/export/native-video.test.ts
Adds getNativeExportCapabilities test import; updates getNvidiaCudaAutoStallTimeoutMs description; introduces getNativeExportCapabilities test suite; refactors getExperimentalNvidiaCudaExportSkipReason tests to cover user opt-in and env-disable cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Checked

Poem

🐰 A rabbit sniffs the GPU breeze,
"Opt-in for CUDA," says with ease.
Toggle on, check wrapper true,
Fall back neatly if probes won't do—
Hops, saves settings, exports with glee.

🚥 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 'feat(export): add NVIDIA opt-in detection' clearly and concisely summarizes the main change—adding NVIDIA opt-in detection capability to the export system.
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.
Description check ✅ Passed PR description is comprehensive and well-structured, covering motivation, scope, platform constraints, safety considerations, and verification steps.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/nvidia-export-opt-in

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.

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: 1

🤖 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 `@src/components/video-editor/VideoEditor.tsx`:
- Around line 631-649: The effect that calls
window.electronAPI?.getNativeExportCapabilities?() must catch promise rejections
so an error doesn't become an unhandled rejection and so the UI falls back to a
deterministic state; update the useEffect (the async then handler around
getNativeExportCapabilities) to add a .catch handler (or use try/catch inside an
async IIFE) that treats any error as available = false, calls
setNvidiaCudaExportAvailable(false), resets
setExperimentalNvidiaCudaExportState(false) if needed, and optionally logs the
error, while still respecting the cancelled flag before updating state.
🪄 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: a0ac908c-7ed9-4d86-a974-c70e3de02089

📥 Commits

Reviewing files that changed from the base of the PR and between 7353ba9 and c85dc8b.

📒 Files selected for processing (9)
  • electron/electron-env.d.ts
  • electron/ipc/export/native-video.test.ts
  • electron/ipc/export/native-video.ts
  • electron/ipc/register/export.ts
  • electron/preload.ts
  • src/components/video-editor/ExportSettingsMenu.tsx
  • src/components/video-editor/VideoEditor.tsx
  • src/lib/exporter/modernVideoExporter.ts
  • src/lib/exporter/types.ts

Comment thread src/components/video-editor/VideoEditor.tsx
@meiiie meiiie merged commit 6e466a3 into main May 22, 2026
5 checks passed
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