Skip to content

Fix song_seconds always reporting 0 (2.3.6) - #72

Merged
liladas merged 1 commit into
mainfrom
fix-song-seconds-detached-buffer
Jul 23, 2026
Merged

liladas merged 1 commit into
mainfrom
fix-song-seconds-detached-buffer

Conversation

@liladas

@liladas liladas commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Every conversion_succeeded event on 2.3.5 reports song_seconds: 0 (confirmed in PostHog, all 3 events since release).

Root cause: @ffmpeg/ffmpeg's writeFile posts the Uint8Array's buffer to the worker with a transfer list, detaching it on the main thread. Converter.tsx read pair.cdg.byteLength after convertCdgToMp4 returned, so it was always 0.

Fix: compute cdgSongSeconds(pair.cdg.byteLength) before starting the conversion.

  • Lint: 0 errors (3 pre-existing warnings)
  • Typecheck: clean
  • Tests: 82 passed

convertCdgToMp4 transfers the CDG Uint8Array's buffer to the ffmpeg
worker (writeFile posts it with a transfer list), detaching it on the
main thread. Reading pair.cdg.byteLength after the conversion therefore
returned 0 for every conversion_succeeded event on 2.3.5. Measure the
song length before starting the conversion instead.
@liladas
liladas merged commit 200d62c into main Jul 23, 2026
3 checks passed
@liladas
liladas deleted the fix-song-seconds-detached-buffer branch July 23, 2026 20:40
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