Repository navigation
Update module github.com/llehouerou/go-mp3 to v1.5.0 - #1469
Merged
Merged
Conversation
Contributor
|
AV-sync stats summary: view in run #39503353775 |
Generated by renovateBot
renovate
Bot
force-pushed
the
renovate/github.com-llehouerou-go-mp3-1.x
branch
from
October 20, 2026 21:48
bbdc9b7 to
fb18a02
Compare
biglittlebigben
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.2.0→v1.5.0Release Notes
llehouerou/go-mp3 (github.com/llehouerou/go-mp3)
v1.5.0Compare Source
Decoding is 1.6x faster than v1.4.0 and allocates almost nothing per frame. The decoder's internals were reshaped around the concepts they implement, with the output pinned by a golden hash and the mpg123 comparison at every step. Four edge-case behaviours changed; read that section before upgrading.
Measured
BenchmarkDecode, whole-file decode toio.Discard,benchstatn=10, 12-thread desktop:classic_lame.mp3)classic.mp3)Frame.Decode(DSP only, one frame)Where it came from, in order of landing:
Frameper stream, not per frame (#15): the decoder state, including the bit reservoir and the synthesis history, is allocated once and reused. This is most of the allocation drop.Behaviour changes
None of these change a signature. All are covered by tests in this release.
Readstops atLength()in both gapless modes. With gapless disabled, a file whose Xing frame count under-reports the frames present used to play pastLength()to EOF, soProgress()could exceed 1. The Xing count is now the length contract whether or not gapless is on.Seekpast the last real frame used to land mid-way through that frame and hand out audio the position does not have. It now reads to EOF.lameinfo.Parserejects Layer I and Layer II headers, as the decoder itself does; a "Xing" tag where Layer III side info would end is not a Xing header in a Layer II frame.NewDecoderreports an error from the gapless head skip instead of swallowing it. Only a source that fails with something other than EOF while discarding the encoder delay is affected.Internals
The decoder is now organised around the concepts in
CONTEXT.md, each behind a small interface with tests at that seam:trimowns gapless trimming: raw/virtual position mapping, zero when gapless is off. The sixlameInfo != nilbranches in the decoder are gone, andSeekis one path instead of two.source.nextFrameis the one place that decides the audio has ended (EOF, a frame cut short, trailing tags past the sync search).internal/granuleturns a frame's bitstream into finished granules: side info, reservoir, scalefactors, Huffman, gains.internal/sideinfoandinternal/maindata, which passed a quartet of pointers between them and wrote into each other's structs, are deleted.internal/frameis the DSP stages only.internal/bitsis a pure bit reader. Its sticky error, which nothing ever read, is gone; the documented contract is that reads past the end yield zero, which the mid-stream reservoir join has always relied on.lameinfoparses the frame header withinternal/frameheaderinstead of its own copy of the bitrate and sample-rate tables.internal/constsis dissolved into the packages that use its pieces.Output accuracy
As with v1.4.0, faster transforms reassociate floating-point additions, so decoded PCM is not bit-identical to v1.4.0. Measured on
example/classic.mp3, 31.3M samples: 7,483 samples (one in 4,200) moved by a single LSB, 3,756 down and 3,727 up. Accuracy against the mpg123 reference is unchanged: RMS 0.7369 on that file, identical to v1.4.0, and 0.708–0.743 across the four test files including MPEG-2, within the pinned budget of RMS < 1.0 / MaxDiff <= 2 (ADR-0002).The architecture commits themselves moved nothing: from the moment the golden hash landed, every refactoring commit decoded the 64-frame fixture to the same SHA-256 as the commit before it.
Verification
TestDecodeGoldenpins the SHA-256 of 64 real LAME frames decoded end to end, and runs everywhere; the mpg123 comparison runs on the same synthesised file where mpg123 is installed, so re-pinning the hash after a legitimate float change is a measured decision.internal/testaudiocan now carry real encoded frames, so the synthesised corpus exercises the whole decoder, not just frame structure.FuzzDecodemutates real frames, MPEG-1 and MPEG-2 files, and a copy of the real frames with intensity stereo set. Undergo test -fuzzit reaches every DSP stage including mixed blocks and both intensity stereo paths, and 90% ofinternal/; ~7M inputs, no panic.v1.4.0: - 2.5x faster decodingCompare Source
Decoding is about 2.5x faster. Nothing in the API changed; the work is entirely in the transform and bit-reading paths, guided by profiles rather than guesses.
Measured
BenchmarkDecode, i7-8700K:Where it came from:
math.Powper coefficient.Output accuracy — read this before upgrading a golden-hash test
Faster transforms reassociate floating-point additions, so decoded PCM is not bit-identical to v1.3.0. Measured on
example/classic.mp3, 31.3M samples:One sample in four thousand moved by a single LSB, evenly split in both directions: dither-level noise at -96 dBFS, inaudible and non-accumulating. Accuracy against the mpg123 reference is unchanged (RMS 0.7369, ISO/IEC 11172-4 limited compliance, same as before).
If you assert an exact hash of decoder output in your own tests, that assertion will fail and needs re-recording. ADR 0002 now states the contract explicitly: output is bounded by an accuracy budget against a reference decoder, not promised stable bit-for-bit across versions.
Also
internal/imdctand the new DCT gained oracle tests that check each fast transform against the cosine matrix it replaced, on impulses, extremes and random inputs.v1.3.0: - Open without scanning the fileCompare Source
Opening a file no longer walks every frame header to learn its length. The frame count comes from the Xing/Info header, peeked out of the first frame before it is decoded; the scan survives only for headerless files, where it is deferred to the first call that needs it, and as the reference the header path is tested against.
Fixes #1, found from a track played off an SMB mount pinning two kernel workers for its whole duration.
Measured
Open +
Length(), counted at theio.Readerboundary:Playing a file through now reads it exactly once instead of twice.
Added
ErrNotSeekable, returned bySeek,SeekToSample,SeekToTimeandSkipon a plainio.Reader.Length,DurationandProgresswork on non-seekable streams that carry a Xing/Info header. Gapless trimming works there too, since the header is now parsed from bytes already read instead of by seeking back.Changed
Unreadwere subtracted from the stream position but never added back when re-read, leaving every recorded frame offset three bytes short.Internal
New test corpus (
internal/testaudio) synthesising CBR/VBR, Xing/Info/headerless, MPEG1/MPEG2, mono/stereo, tag-wrapped, truncated and lying-header files, plus a counting reader used to assert I/O budgets directly, and a differential test holding the header-derived length to what a full frame count produces — on synthetic files and on real LAME output.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.