Add support for audio files of more than 2GB (find_frames function); fixes #13#14
Add support for audio files of more than 2GB (find_frames function); fixes #13#14arigit wants to merge 17 commits into
Conversation
The flac_find_frame function was changed to return off_t instead of int
64-bit return type to prevent 32-bit overflow with large flac files
Fixes the 32b rollover in files of more than 2GB
Fixes support for files of more than 2GB
Fixes support for files of > 2GB, prevents 32b rollover
Fixes support for files of > 2GB, prevents 32b counter rollover
Fixes support for files of more than 2GB
fixes support for files > 2GB
Fix for support of files > 2GB
fix support for files > 2GB
fix support for files > 2GB
Fixes support for files > 2GB
fixes support of files > 2GB
fixes support for files > 2GB
Perl-native 64b; off_t does not apply here (that is only for C code)
Fix for files > 2GB
|
Thank you for providing the PR. I'll review and test over the next few days. |
|
My own patch test notes for reference that I had included in the bug discussion, but they belong here. The patch-set changes all the (*_find_frames) functions, changing return type from int/32bit to off_t/64 bits, c files, header files, and Scan.xs in alignment. I built the updated binary inside the latest stable LMS 9.1 container, it builds clean (no warnings), and then tested it by replacing scan.so within the container. I rescanned my library, problem solved, all the negative starting frame values are gone. I had some 70 albums (hundreds of tracks) that were affected by this. I tested playback of many of the formerly unplayable tracks (the ones beyond the 2GB boundary) - fully playable, issue fixed. I recommend exposing this change in nightly builds for a while, my collection only has flacs so we want to expose this to more diverse testing. Other formats that should now work with files of more than 2GB: ogg, opus, ogv, mp4, asf, mp3. While it's common to have these days hi-res multi-track flac going beyond 2GB that would trigger the problem, I saw postings in the forum of people having issues with very long single-track recordings as well. The old issue impacted very long high-bit-rate mp3, ogg etc, which should now work fine with LMS. |
This patch set changes the return type for the *_find_frame functions in all of the Audio Formats that support it (e.g. flac, ogg, ogf, mp4 etc). We change the type to off_t in C, IV in perl, i.e. 64 bit. The original type was 32 bits integer.
Fixes: #13
Before this change, find_frame was returning a negative value when the seek result was pointing to frames that were past the 2GB byte mark in the audio file. This was due to the rollover of the 32 bit integer that was used, unable to accomodate values larger than 2*10^9.
One effect of this issue was that during a library scan, if a multi-track file (e.g. single-flac+cuesheet) was larger than 2GB and there were tracks past the 2GB mark, those tracks get added to the library with a meaningless negative value as starting frame and were not playable in lyrion.
For people using multi-track flac containers, typical Hi-Res 2-channel albums with a total length of more than ~100 minutes were affected by this problem.