Merge pull request #335 from eloc3147/master

Fix for overflow on 32bit
This commit is contained in:
est31 2020-10-27 00:00:39 +01:00 committed by GitHub
commit 7d61d283cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,8 +114,8 @@ where
#[inline] #[inline]
fn total_duration(&self) -> Option<Duration> { fn total_duration(&self) -> Option<Duration> {
let ms = self.len() * 1000 / (self.channels as usize * self.sample_rate as usize); let ms = self.len() as u64 * 1000 / (self.channels as u64 * self.sample_rate as u64);
Some(Duration::from_millis(ms as u64)) Some(Duration::from_millis(ms))
} }
} }