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.
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.