Skip to content

Conversation

@enzo1982
Copy link

An issue handling long MP4 files containing audio books with hundreds of chapters was reported by a fre:ac user. Turned out the issue is with MP4v2.

In MP4Track::GetSampleTimes and MP4Track::GetSampleIdFromTime, sampleCount is a 32 bit value that is later multiplied by sampleDelta in 32 bit math. We need this multiplication to happen in 64 bit math to handle long tracks, so promote sampleCount to a 64 bit variable.

An alternative solution would be to add casts to uint64_t where the multiplications happen, but changing the value type seemed more elegant to me. If you prefer it the other way, I can change this PR accordingly.

In MP4Track::GetSampleTimes and MP4Track::GetSampleIdFromTime, sampleCount is a 32 bit value that is later multiplied by sampleDelta in 32 bit math. We need this multiplication to happen in 64 bit math to handle long tracks, so promote sampleCount to a 64 bit variable.
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