Skip to content

Correct mp3 looping, frame num, and sum decoded - #12005

Merged
hrydgard merged 6 commits into
hrydgard:masterfrom
unknownbrackets:mp3
Apr 29, 2019
Merged

hrydgard merged 6 commits into
hrydgard:masterfrom
unknownbrackets:mp3

Conversation

@unknownbrackets

Copy link
Copy Markdown
Collaborator

Highlights:

  • sceMp3GetFrameNum returns the number of frames the file holds based on its size.
    Note: per More mp3 tests pspautotests#199, vbr Xing/Info/etc. isn't handled.
  • sceMp3GetSumDecodedSample should reset to 0 on loop, and isn't doubled for stereo.
  • Looping was being performed in sceMp3NotifyAddStreamData, which my tests show is incorrect. Both loop and sum decoded go down after decode.
  • If sceMp3Decode was given data before a sync, it would just fail, rather than correctly seeking ahead to the sync. This may improve playback of some mp3 files.
  • sceMp3Decode was not rescheduling properly, and the delay was too high (much higher than my tests show.)
  • Setting any negative loop count should read only as -1.

All based on tests in hrydgard/pspautotests#199. Note: some of the tests don't pass, but only due to sceMp3LowLevelInit rescheduling issues. I still wanted to keep that in the tests to verify error behavior with low level streams.

-[Unknown]

Might matter if some game is checking the result.
This might fix games failing to play mp3s correctly.
It shouldn't consider both channels of stereo.  This could've been causing
some games to think they were playing audio at an incorrect speed.
And only on loop, not when getting add info (which clearly doesn't loop,
from tests.)
If the offset points to an ID3 tag or the middle of a frame, that's fine -
it should just search forward to the next sync.  FFmpeg just returns a
decode error, so we do this first.
@unknownbrackets unknownbrackets added this to the v1.9.0 milestone Apr 28, 2019
@unknownbrackets

Copy link
Copy Markdown
Collaborator Author

FWIW, I have more mp3 changes - I just again want them in a separate PR (and they depend on these changes.) The reset and reset by frame funcs are pretty wrong, and I'll be fixing the broken ID3 handling.

-[Unknown]

@hrydgard

Copy link
Copy Markdown
Owner

Alright, cool. This seems all fine - merging.

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.

2 participants