Skip to content

Conversation

@DeeJayLSP
Copy link
Contributor

@DeeJayLSP DeeJayLSP commented Sep 4, 2024

Last time minimp3 got updated was in November 2021 (almost 3 years ago by the time this PR was opened).

Meanwhile, dr_mp3, a piece of work done on top of minimp3, has been updated quite recently.

Within Godot, it fixes a few issues:

Template release binary sizes remain the same.

Since minimp3 is removed, the following are also changed in this PR:

  • minimp3 module renamed to mp3, to better reflect its purpose rather than naming its dependency;
  • minimp3_extra_formats build variable renamed to mp3_extra_formats.

This should not break compatibility unless module/build option name changes count (does not affect existing projects™).

@DeeJayLSP
Copy link
Contributor Author

Fixed an issue that caused single channel MP3 files to play badly.

This fix could also be applied to #80160 if it was viable

@DeeJayLSP DeeJayLSP marked this pull request as ready for review September 4, 2024 14:12
@DeeJayLSP DeeJayLSP force-pushed the drmp3 branch 2 times, most recently from 88b551a to e894f03 Compare September 4, 2024 19:59
@DeeJayLSP

This comment has been minimized.

@DeeJayLSP DeeJayLSP marked this pull request as draft September 7, 2024 00:03
@DeeJayLSP
Copy link
Contributor Author

It looks like a fix is coming: mackron/dr_libs@0463355

@DeeJayLSP DeeJayLSP force-pushed the drmp3 branch 6 times, most recently from b1857da to f592860 Compare March 8, 2025 22:32
@DeeJayLSP DeeJayLSP marked this pull request as ready for review March 8, 2025 22:46
@DeeJayLSP DeeJayLSP requested a review from a team as a code owner March 8, 2025 22:46
@DeeJayLSP
Copy link
Contributor Author

DeeJayLSP commented Mar 8, 2025

Current version has the issue fixed. Despite being a dev version I didn't notice any problems.

Maybe it's safe to mark as ready now. I'll keep it updated while it's open.

@DeeJayLSP
Copy link
Contributor Author

DeeJayLSP commented May 28, 2025

Considering that I'm also trying to make a module named dr_wav in #96545, should the module in this PR be named dr_mp3 instead of just mp3?

mp3 makes it clearer this is for MP3 support, while dr_mp3 has the name of the dependency, like it is already with minimp3.

@Calinou
Copy link
Member

Calinou commented May 28, 2025

I would rename the module to just mp3. It's more intuitive for people using SCons options to disable features, and it follows the naming scheme of most existing modules more closely (gltf, fbx).

@DeeJayLSP
Copy link
Contributor Author

Rebased on top of master. Added a dr_alloc_calls.h file also used by dr_wav in #96545.

Due to renaming an entire module folder, any minor changes to the minimp3 module require a rebase.

@DeeJayLSP DeeJayLSP force-pushed the drmp3 branch 5 times, most recently from 4997a3d to 70976ad Compare September 3, 2025 22:42
@adamscott adamscott modified the milestones: 4.x, 4.6 Sep 30, 2025
@adamscott
Copy link
Member

Reviewed during the Audio team meeting. We will test the PR just to make sure and individually review it in the next days. But this PR should be approved and merged early during 4.6 dev cycle.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on the Run-time saving and loading demo, it works as expected. Code looks good to me.

I can confirm building with LTO also no longer reproduces warnings for MP3 code on GCC 15.2.1. There are still plenty of other LTO warnings produced though (e.g. by polypartition, VHACD, libjpeg-turbo, …).

Edit: There are some bugs with the PR, see #96547 (comment).

@Calinou
Copy link
Member

Calinou commented Sep 30, 2025

I actually found that MP3 playback breaks on some longer files (resulting in audible stuttering and slowed down playback), even though it appears fine in the first 5 seconds of playback. It plays correctly in master.

Try playing this MP3 in the run-time loading/saving demo, for instance: Marc A. Pullen - Aeroembolism.zip

[mp3 @ 0x55f1d5a4a940] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'Fanatic/Marc A. Pullen - Aeroembolism.mp3':
  Metadata:
    title           : Aeroembolism
    artist          : Marc A. Pullen
    album           : RTC-3057
    track           : 8
    comment         : Free download from http://www.last.fm/music/Marc+A.+Pullen and http://MP3.com
  Duration: 00:04:00.04, start: 0.000000, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3 (mp3float), 44100 Hz, stereo, fltp, 128 kb/s

This one is fine though, in comparison: Crimson Blue - Iceland -02.zip

Input #0, mp3, from 'Crimson Blue/Iceland/02.mp3':
  Metadata:
    title           : Ave Sensorium
    album           : Iceland
    track           : 2/5
    copyright       : 2011 Crimson Blue. Licensed to the public under http://creativecommons.org/licenses/by-sa/3.0/ verify at http://www.jamendo.com/album/87605/
    artist          : Crimson Blue
    encoded_by      : Jamendo : http://www.jamendo.com/ | LAME
    TLEN            : 257000
    TOFN            : 02 - Ave Sensorium.mp3
    creation_time   : 2011-3-19
    TDOR            : 2011-03-19
    comment         : http://www.jamendo.com/
    genre           : Classic Rock
    lyrics-eng      : [...]
    http://www.jamendo.com/: http://www.jamendo.com/
    date            : 2011
  Duration: 00:04:16.42, start: 0.025056, bitrate: 188 kb/s
  Stream #0:0: Audio: mp3 (mp3float), 44100 Hz, stereo, fltp, 188 kb/s
      Metadata:
        encoder         : LAME3.96r
      Side data:
        replaygain: track gain - -7.500000, track peak - unknown, album gain - unknown, album peak - unknown,
  Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 400x400 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn (attached pic)
      Metadata:
        title           : Crimson Blue : Iceland
        comment         : Cover (front)
  Stream #0:2: Video: png, rgb24(pc, gbr/unknown/unknown), 200x50, 90k tbr, 90k tbn (attached pic)
      Metadata:
        title           : http://www.jamendo.com
        comment         : Lyricist/text writer
  Stream #0:3: Video: png, rgba(pc, gbr/bt709/bt470m), 88x31 [SAR 2835:2835 DAR 88:31], 90k tbr, 90k tbn (attached pic)
      Metadata:
        title           : http://creativecommons.org/licenses/by-sa/3.0/
        comment         : Other

Notice how the first one has no bitrate information, so it has to be guessed from the file by ffprobe.

@DeeJayLSP
Copy link
Contributor Author

DeeJayLSP commented Sep 30, 2025

Rebased.

I actually found that MP3 playback breaks on some longer files (resulting in audible stuttering and slowed down playback), even though it appears fine in the first 5 seconds of playback. It plays correctly in master.

I tried to modify the PR back then so the code would be similar to the Ogg Vorbis player. Reverting that seems to have solved this issue (given file plays normally).

@DeeJayLSP DeeJayLSP force-pushed the drmp3 branch 2 times, most recently from 3af7fe3 to 1afe615 Compare September 30, 2025 20:42
@goatchurchprime
Copy link
Contributor

I just compiled and checked that this PR works on nixos (linux) after the audio meeting, so it looks good to me.

Do you think it's possible to write down a "Review date" in the future in the code of frozen third-party libraries like this, when developer teams are encouraged to check upstream for any important versions that should be pulled in?

@DeeJayLSP DeeJayLSP force-pushed the drmp3 branch 2 times, most recently from a0fc7c6 to 88e48c1 Compare October 1, 2025 16:35
@DeeJayLSP
Copy link
Contributor Author

Do you think it's possible to write down a "Review date" in the future in the code of frozen third-party libraries like this, when developer teams are encouraged to check upstream for any important versions that should be pulled in?

Because a single repository had tags for a MP3, WAV and FLAC library, I was unsure of how to inform the tags correctly in the thirdparty README so I just pulled it from the latest git.

But I recalled: the three tend to have a release at the same time. I have modified so it uses the latest dr_mp3 tag instead. In case we implement the others in the future, we can just the correct tag for the latest used one.

@Calinou
Copy link
Member

Calinou commented Oct 1, 2025

I can confirm the playback issue I mentioned above is fixed now.

@DeeJayLSP
Copy link
Contributor Author

Rebased after recent changes.

Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test any MP3 files, but the code seems right. Thanks @DeeJayLSP !

@DeeJayLSP
Copy link
Contributor Author

Removed the public-domain declaration ahead of #112006

@DeeJayLSP DeeJayLSP requested a review from akien-mga October 25, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants