Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpg123 doesn't store original file offset, causing seek errors when playing #254

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.4
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2018-12-03 12:48:04 +0000, Anthony @ POW Games wrote:

When using Mix_LoadMUS_RW to load an MP3 that is part of a large file containing multiple MP3s, seeking errors will occure when attempting to play. Apparently the original file offset is not saved, so it presumably seeks from the beginning of the file, rather than beginning of the MP3 inside the file.

On 2018-12-03 15:08:58 +0000, Anthony @ POW Games wrote:

Created attachment 3521
Test code to reproduce the bug

On 2018-12-03 15:09:55 +0000, Anthony @ POW Games wrote:

Created attachment 3522
test data file containing MP3 data at offset 69531

On 2018-12-03 15:15:00 +0000, Anthony @ POW Games wrote:

Here's the test code and a test data file containing MP3 data at offset 69531.

I've found out that it's a little more complicated than mpg123 not storing the original offset because everything works if the offset is less than about 65K (there's a clue there). Once the MP3 offset is higher than about 65k, then the MP3 doesn't play. Maybe the offset is stored in, or filtered through a Uint16?

Note that this test code doesn't return any errors, even if playing fails. This is a very small MP3 file for testing. In my big project there's a lot more going on and big MP3 files, and it was returning seek errors. But this test code still demonstrates the error. I tested on a data file with low offsets and it worked ok. The MP3 loads no problem, proving that the MP3 file and offset are correct. If you try to play the MP3 again and again in the main look, you can hear a quiet clicking, so something is happening.

On 2018-12-24 09:35:03 +0000, Ozkan Sezer wrote:

This shouldn't be limited to mp3 (mpg123): the ogg player doesn't
store the original offset either. (Only mikmod player does that,
I think..)

On 2021-01-28 03:51:12 +0000, Ozkan Sezer wrote:

I have a one-liner fix for your specific issue in the current
development SDL_mixer tree, but SDL_RWsize() can be problematic
(bug # 5509.)

On 2021-01-28 14:05:38 +0000, Ozkan Sezer wrote:

Fixed as of https://hg.libsdl.org/SDL_mixer/rev/16645c8ed64a
for next SDL2_mixer release. (Please confirm.)

Fix also applied to SDL-1.2 branch:
https://hg.libsdl.org/SDL_mixer/rev/ad8fd052d556

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

No branches or pull requests

1 participant