mirror of
https://github.com/RustAudio/rodio
synced 2025-03-02 14:07:15 +00:00
Fix wrong total duration cause by divided by zero
This commit is contained in:
parent
bc8d1c7e05
commit
77896cc498
1 changed files with 3 additions and 2 deletions
|
@ -170,8 +170,9 @@ impl Source for SymphoniaDecoder {
|
|||
|
||||
#[inline]
|
||||
fn total_duration(&self) -> Option<Duration> {
|
||||
self.total_duration
|
||||
.map(|Time { seconds, frac }| Duration::new(seconds, (1f64 / frac) as u32))
|
||||
self.total_duration.map(|Time { seconds, frac }| {
|
||||
Duration::new(seconds, if frac > 0.0 { (1f64 / frac) as u32 } else { 0 })
|
||||
})
|
||||
}
|
||||
|
||||
fn try_seek(&mut self, pos: Duration) -> Result<(), source::SeekError> {
|
||||
|
|
Loading…
Add table
Reference in a new issue