mirror of
https://github.com/RustAudio/rodio
synced 2024-12-04 17:29:20 +00:00
Merge remote-tracking branch 'rust-audio/master' into test-fixes
This commit is contained in:
commit
43742f6b5f
2 changed files with 16 additions and 2 deletions
|
@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Breaking: `Sink::try_new` renamed to `connect_new` and does not return error anymore.
|
||||
`Sink::new_idle` was renamed to `new`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Symphonia decoder `total_duration` incorrect value caused by conversion from `Time` to `Duration`.
|
||||
|
||||
# Version 0.20.1 (2024-11-08)
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -170,8 +170,7 @@ 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_to_duration)
|
||||
}
|
||||
|
||||
fn try_seek(&mut self, pos: Duration) -> Result<(), source::SeekError> {
|
||||
|
@ -305,6 +304,17 @@ fn skip_back_a_tiny_bit(
|
|||
Time { seconds, frac }
|
||||
}
|
||||
|
||||
fn time_to_duration(time: Time) -> Duration {
|
||||
Duration::new(
|
||||
time.seconds,
|
||||
if time.frac > 0.0 {
|
||||
(1f64 / time.frac) as u32
|
||||
} else {
|
||||
0
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
impl Iterator for SymphoniaDecoder {
|
||||
type Item = i16;
|
||||
|
||||
|
|
Loading…
Reference in a new issue