• Aryan Noshirvnai's avatar
    Fix the real "can't sync to MPEG frame" cause: mutagen, not ffmpeg · f2a1dce8
    Aryan Noshirvnai authored
    The previous fix (permissive ffmpeg retry on CouldntDecodeError) never
    actually applied to this case - confirmed via the full traceback this time
    (added logger.exception in the prior commit, which paid off immediately):
    the failing file had a .mp3 extension, so it took the "already mp3, just
    copy" fast path entirely, skipping ffmpeg. The actual failure was
    mutagen.mp3.HeaderNotFoundError inside MP3(mp3_file_path, ID3=ID3) - a
    .mp3 extension doesn't guarantee mutagen's strict frame-sync scanner can
    parse the content.
    
    Now: if that direct-copy fast path produces something mutagen can't read,
    re-encode through the same permissive ffmpeg fallback (which sniffs actual
    content, not the extension) and retry once. If even that fails, raises the
    same AudioDecodeError as before for a clean user-facing message instead of
    a raw mutagen exception.
    
    Added tests/test_audio_processing.py with two real (not mocked) cases:
    real WAV audio misnamed as .mp3 (exercises the actual recovery path with
    real audio content) and pure random bytes (confirms genuinely unrecoverable
    input still fails cleanly via AudioDecodeError, not a raw exception).
    Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
    f2a1dce8
Name
Last commit
Last update
alembic Loading commit data...
deploy Loading commit data...
scripts Loading commit data...
src Loading commit data...
tests Loading commit data...
.env.example Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
Dockerfile Loading commit data...
README.md Loading commit data...
alembic.ini Loading commit data...
docker-compose.yml Loading commit data...
requirements-remix.txt Loading commit data...
requirements.txt Loading commit data...
setup.sh Loading commit data...