From 42fc963acc81860b7cc794550e13e8920e547d93 Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 1 Jul 2025 14:22:37 +1000 Subject: Increase size of sample count fields in MP3 decoder (fixes #408) --- src/codecs/include/codec.hpp | 2 +- src/codecs/include/mad.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/codecs/include/codec.hpp b/src/codecs/include/codec.hpp index 6ff7a267..42ce9844 100644 --- a/src/codecs/include/codec.hpp +++ b/src/codecs/include/codec.hpp @@ -105,7 +105,7 @@ class ICodec { struct OutputFormat { uint8_t num_channels; uint32_t sample_rate_hz; - std::optional total_samples; + std::optional total_samples; std::optional bitrate_kbps; bool operator==(const OutputFormat&) const = default; diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index 60a0b81c..ccf996e6 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -40,7 +40,7 @@ class MadMp3Decoder : public ICodec { struct Mp3Info { uint16_t starting_sample; - uint32_t length; + uint64_t length; std::optional bytes; std::optional> toc; }; @@ -59,9 +59,9 @@ class MadMp3Decoder : public ICodec { // Count of samples processed in the current frame (channels combined) int current_frame_sample_; // Count of samples processed in the current stream (channels separate, i.e. usually x2) - int current_stream_sample_; + uint64_t current_stream_sample_; // How many samples in the current stream (channels separate) with encoder delay/padding removed - int total_samples_; + uint64_t total_samples_; // Encoder delay, i.e. how many samples to skip at the start of the stream int skip_samples_; bool is_eof_; -- cgit v1.2.3