Commit graph

8 commits

Author SHA1 Message Date
Christopher Snowhill
8f595af704 Bug Fix: Retry MP3 file a few times before failure
Give up after 10 tries.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-24 16:05:19 -07:00
Christopher Snowhill
f73cde09ee Bug Fix: Fix minimp3 to deal with invalid files
If a file can't decode, there should not be a division by zero error.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-24 15:42:30 -07:00
Christopher Snowhill
2c4ca7d51d Bug Fix: Fix minimp3 streaming support
The streaming support was breaking because initial packet detection was
failing due to bit reservoir errors. Instead, detect consecutive sync
frames in the initial read buffer, then attempt to sync to a decodable
frame in the first block of data, otherwise give up.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-24 08:16:37 -07:00
Christopher Snowhill
2ef4594916 Bug Fix: Fix minimp3 seek position
Seek offset is scaled by the number of channels in the file. Oops again.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-23 20:22:39 -07:00
Christopher Snowhill
fc2a14b0fa Bug Fix: Free memory buffers used by minimp3
This was being leaked when playing static, seekable files. Oops.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-23 20:03:44 -07:00
Christopher Snowhill
410395dded minimp3: Numerous buffering fixes, consolidation
Move minimp3 packet decoder state into the decoder_ex state structure,
instead of using the redundant duplicate structure. Also reduce input
buffer size for streams to 16KiB, and actually use the defined macro in
the header file to declare the streaming buffer size.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-23 20:02:58 -07:00
Christopher Snowhill
6e8538c7c9 minimp3: Fix seeking behavior
Seeking should clear the sample buffer if it contains anything, and non-
seekable files should return an error on an attempt to seek.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-23 16:18:07 -07:00
Christopher Snowhill
3a62776fa6 MP3: Replace MAD with minimp3
libMAD had memory safety issues, possibly with corrupt files. Hopefully,
this will fix the problem.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-22 23:59:11 -07:00