Skip to content

fix: seek disk-streamed MP3s from a seek table instead of decoding from the start - #636

Merged
alnitak merged 4 commits into
mainfrom
mp3-stream-seek-table
Dec 4, 2026
Merged

alnitak merged 4 commits into
mainfrom
mp3-stream-seek-table

Conversation

@alnitak

@alnitak alnitak commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Description

Supersedes #634 by @Fmarschall, whose commit is the first one here, unchanged. Its branch is in a fork owned by an organization, which maintainers cannot push to, so the additions are in this PR.

The change of #634

  • A voice of an MP3 loaded with LoadMode.disk seeks with drmp3_seek_to_pcm_frame, and no seek table was bound to the decoder. dr_mp3 then seeks backwards by decoding the file from its first frame up to the target, under the audio mutex: a seek near the end of a song read most of the file, a seek slider stuttered and every voice dropped out until the seek finished.
  • A seek table, built with drmp3_calculate_seek_points from the frame headers, is now bound to the decoder. It holds four points a second, at most 16384, 24 bytes each. dr_mp3 itself is unchanged; the change is a marked local patch in soloud_wavstream.cpp/.h.
  • The notes that advised LoadMode.memory for MP3s that are sought are removed.

Added on top

Type of Change

  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • 📝 Documentation

florian and others added 4 commits December 4, 2026 07:52
- the table is the sound's and its voices share it: play() no longer reads the whole file twice to start a voice
- a table that cannot be built leaves no voice decoder part way through the file
- test: starting a voice reads only the head of the file, and a second voice seeks as well
- changelog, dartdoc and loading skill
@alnitak
alnitak merged commit 8eb241c into main Dec 4, 2026
1 check passed
@alnitak
alnitak deleted the mp3-stream-seek-table branch December 4, 2026 19:45
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