From a0668696bc67b9bd060a0bdf29eb24e08d070b30 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sat, 18 Apr 2026 21:38:05 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20address=20CodeRabbit=20review=20?= =?UTF-8?q?=E2=80=94=20fallback,=20i18n,=20return=20type=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change ?? 99 fallback to ?? 100 in finalizing progress label - Add editor.export.processingAudioEdits i18n key to all 5 locales - Tighten sourceTimeToOutputTime return type to number (was number|null) - Remove now-unused totalOutputDurationMs param from scheduleRegionForChunk - Remove ?? fallbacks at call sites (function always returns a number) --- src/components/video-editor/VideoEditor.tsx | 2 +- src/i18n/locales/en/editor.json | 3 +++ src/i18n/locales/es/editor.json | 3 +++ src/i18n/locales/ko/editor.json | 3 +++ src/i18n/locales/nl/editor.json | 3 +++ src/i18n/locales/zh-CN/editor.json | 3 +++ src/lib/exporter/audioEncoder.ts | 15 +++++---------- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx index 9c99b88d..42debcad 100644 --- a/src/components/video-editor/VideoEditor.tsx +++ b/src/components/video-editor/VideoEditor.tsx @@ -4234,7 +4234,7 @@ export default function VideoEditor() { }) : isExportFinalizing ? t("editor.exportStatus.finalizingPercent", "Finalizing {{percent}}%", { - percent: Math.round(exportFinalizingProgress ?? 99), + percent: Math.round(exportFinalizingProgress ?? 100), }) : t("editor.exportStatus.completePercent", "{{percent}}% complete", { percent: Math.round(exportProgress.percentage), diff --git a/src/i18n/locales/en/editor.json b/src/i18n/locales/en/editor.json index 38159315..cf070cde 100644 --- a/src/i18n/locales/en/editor.json +++ b/src/i18n/locales/en/editor.json @@ -122,6 +122,9 @@ "complete": "Export complete", "savedSuccessfully": "Your file was saved successfully." }, + "export": { + "processingAudioEdits": "Processing audio with speed/overlay edits" + }, "toolbar": { "addLayer": "Add Layer", "splitClip": "Split Clip (C)" diff --git a/src/i18n/locales/es/editor.json b/src/i18n/locales/es/editor.json index 3f0441ec..a42ea123 100644 --- a/src/i18n/locales/es/editor.json +++ b/src/i18n/locales/es/editor.json @@ -122,6 +122,9 @@ "complete": "Exportación completada", "savedSuccessfully": "Tu archivo se guardó correctamente." }, + "export": { + "processingAudioEdits": "Procesando audio con ediciones de velocidad/superposición" + }, "toolbar": { "addLayer": "Agregar capa", "splitClip": "Dividir clip (C)" diff --git a/src/i18n/locales/ko/editor.json b/src/i18n/locales/ko/editor.json index a364237c..56eb6bc5 100644 --- a/src/i18n/locales/ko/editor.json +++ b/src/i18n/locales/ko/editor.json @@ -123,6 +123,9 @@ "complete": "내보내기 완료", "savedSuccessfully": "파일이 성공적으로 저장되었습니다." }, + "export": { + "processingAudioEdits": "속도/오버레이 편집으로 오디오 처리 중" + }, "toolbar": { "addLayer": "레이어 추가", "splitClip": "클립 분할 (C)" diff --git a/src/i18n/locales/nl/editor.json b/src/i18n/locales/nl/editor.json index d4b00f8d..b174ca98 100644 --- a/src/i18n/locales/nl/editor.json +++ b/src/i18n/locales/nl/editor.json @@ -123,6 +123,9 @@ "complete": "Export voltooid", "savedSuccessfully": "Je bestand is succesvol opgeslagen." }, + "export": { + "processingAudioEdits": "Audio verwerken met snelheids-/overlay-bewerkingen" + }, "toolbar": { "addLayer": "Laag toevoegen", "splitClip": "Clip splitsen (C)" diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.json index a4dec228..4a0c4a5d 100644 --- a/src/i18n/locales/zh-CN/editor.json +++ b/src/i18n/locales/zh-CN/editor.json @@ -122,6 +122,9 @@ "complete": "导出完成", "savedSuccessfully": "文件已成功保存。" }, + "export": { + "processingAudioEdits": "正在处理带有速度/叠加编辑的音频" + }, "toolbar": { "addLayer": "添加图层", "splitClip": "拆分片段 (C)" diff --git a/src/lib/exporter/audioEncoder.ts b/src/lib/exporter/audioEncoder.ts index 31bf5553..e271c541 100644 --- a/src/lib/exporter/audioEncoder.ts +++ b/src/lib/exporter/audioEncoder.ts @@ -611,9 +611,7 @@ export class AudioProcessor { // Extend for audio regions that might exceed the video timeline for (const { region } of regionEntries) { const regionEndOutput = this.sourceTimeToOutputTime(region.endMs, slices); - if (regionEndOutput !== null) { - outputDurationMs = Math.max(outputDurationMs, regionEndOutput); - } + outputDurationMs = Math.max(outputDurationMs, regionEndOutput); } const numChannels = Math.min(primaryBuffer?.numberOfChannels ?? 2, 2); @@ -744,7 +742,7 @@ export class AudioProcessor { chunkIndex: number, ) => Promise, ): Promise { - const { slices, outputDurationMs, numChannels } = prepared; + const { slices, numChannels } = prepared; let outputOffsetSec = 0; const chunkCount = Math.ceil(totalOutputSec / OFFLINE_CHUNK_DURATION_SEC); @@ -792,7 +790,6 @@ export class AudioProcessor { buffer, region, slices, - outputDurationMs, outputOffsetSec, chunkSec, ); @@ -814,13 +811,11 @@ export class AudioProcessor { buffer: AudioBuffer, region: AudioRegion, slices: TimelineSlice[], - totalOutputDurationMs: number, chunkOutputStartSec: number, chunkDurationSec: number, ): void { - const outputStartMs = this.sourceTimeToOutputTime(region.startMs, slices) ?? 0; - const outputEndMs = - this.sourceTimeToOutputTime(region.endMs, slices) ?? totalOutputDurationMs; + const outputStartMs = this.sourceTimeToOutputTime(region.startMs, slices); + const outputEndMs = this.sourceTimeToOutputTime(region.endMs, slices); let localStartSec = outputStartMs / 1000 - chunkOutputStartSec; let localEndSec = outputEndMs / 1000 - chunkOutputStartSec; @@ -1240,7 +1235,7 @@ export class AudioProcessor { private sourceTimeToOutputTime( sourceMs: number, slices: TimelineSlice[], - ): number | null { + ): number { let outputMs = 0; for (const slice of slices) {