Skip to content

fix(export): tighten native audio safety guards#560

Merged
meiiie merged 1 commit into
mainfrom
fix/native-audio-safety-guards
May 22, 2026
Merged

fix(export): tighten native audio safety guards#560
meiiie merged 1 commit into
mainfrom
fix/native-audio-safety-guards

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 22, 2026

Summary

  • Reject CUDA inline-audio summaries when an audio stream exists but has no duration metadata.
  • Avoid stream-copying unknown source audio codecs into MP4; transcode to AAC instead.
  • Add regression coverage for both native audio safety guards.

Why

This is a final small audio-safety slice from #504. Native export should only trust CUDA inline audio when the output audio stream can be validated, and MP4 muxing should not copy unknown sidecar/WAV/PCM-like codecs blindly.

This PR intentionally avoids route planner, CUDA compositor binary, and dev launcher changes.

Verification

  • npm test -- electron/ipc/export/native-video.test.ts
  • npx tsc --noEmit
  • npx biome check --formatter-enabled=false electron/ipc/export/native-video.ts electron/ipc/export/native-video.test.ts
  • git diff --check

Summary by CodeRabbit

Bug Fixes

  • Fixed audio codec handling during MP4 exports—unknown audio codecs are now properly transcoded to AAC instead of causing potential issues.
  • Improved validation for NVIDIA CUDA exports to properly detect missing audio duration data, preventing invalid export configurations.
  • Enhanced edge-case handling for missing or unspecified audio codec information during video export operations.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

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: ed6ef344-883b-478c-9ad8-b672e283b0a6

📥 Commits

Reviewing files that changed from the base of the PR and between 81e4739 and 591fde8.

📒 Files selected for processing (2)
  • electron/ipc/export/native-video.test.ts
  • electron/ipc/export/native-video.ts

📝 Walkthrough

Walkthrough

This PR adds validation refinements for audio codec handling in MP4 muxing and NVIDIA CUDA exports. Empty audio codecs now correctly return false from copy-into-MP4 checks, forcing transcoding. CUDA validation now distinguishes missing audio duration from non-positive duration in inline-audio exports. Test coverage validates all three changes.

Changes

Audio codec handling and CUDA validation refinements

Layer / File(s) Summary
Audio codec copy and mux behavior
electron/ipc/export/native-video.ts, electron/ipc/export/native-video.test.ts
canCopyAudioCodecIntoMp4 now returns false for empty/unspecified codecs instead of true, triggering transcoding. Tests verify that unknown codecs (WAV) transcode to AAC in MP4 mux operations and that undefined and empty-string inputs are blocked.
CUDA export audio duration validation
electron/ipc/export/native-video.ts, electron/ipc/export/native-video.test.ts
validateNvidiaCudaExportSummary now explicitly reports "missing output audio duration" when outputAudioDurationSec is null, and separately flags non-positive duration. Tests verify rejection of inline-audio CUDA output when duration is missing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • webadderallorg/Recordly#558: Both PRs update validateNvidiaCudaExportSummary to refine CUDA inline-audio validation, with this PR's missing/non-positive duration distinction building directly on the same validator logic.

Suggested labels

Checked

Poem

🐰 A rabbit hops through codec streams,
Splitting truths from missing dreams—
Null is null, and zero's zero,
Validation's now a clearer hero!
Empty codecs find their way,
Transcoded right another day.

🚥 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 accurately summarizes the main changes: tightening audio safety validation and codec handling for native video exports.
Description check ✅ Passed The description covers key sections (Summary, Why, Verification) and explains the problem, solution, and testing approach, though it does not follow the template structure exactly.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/native-audio-safety-guards

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.


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 merged commit 1e35031 into main May 22, 2026
3 checks passed
@meiiie meiiie deleted the fix/native-audio-safety-guards branch May 22, 2026 13:03
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