Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- **MusePack**: Fix potential panic when the beginning silence makes up the entire sample count ([PR](https://github.com/Serial-ATA/lofty-rs/pull/449))

## [0.21.1] - 2024-08-28

### Changed
Expand Down
8 changes: 8 additions & 0 deletions lofty/src/musepack/sv8/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ pub(super) fn read(
}

let total_samples = sample_count - beginning_silence;
if total_samples == 0 {
log::warn!(
"Sample count (after removing beginning silence) is 0, unable to calculate duration \
and bitrate"
);
return Ok(properties);
}

let length = (total_samples * 1000).div_round(u64::from(sample_rate));

properties.duration = Duration::from_millis(length);
Expand Down
Loading