mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-03 09:49:31 +02:00
Improve player (#823)
* Improve error handling * Harmonize `Seek`: Make the decoders and player use the same math for converting between samples and milliseconds * Reduce duplicate calls: Make decoder seek in PCM, not ms * Simplify decoder errors with `thiserror`
This commit is contained in:
parent
949ca4fded
commit
89577d1fc1
11 changed files with 280 additions and 242 deletions
|
@ -148,7 +148,10 @@ impl<'a> Sink for PortAudioSink<'a> {
|
|||
};
|
||||
}
|
||||
|
||||
let samples = packet.samples();
|
||||
let samples = packet
|
||||
.samples()
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;
|
||||
|
||||
let result = match self {
|
||||
Self::F32(stream, _parameters) => {
|
||||
let samples_f32: &[f32] = &converter.f64_to_f32(samples);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue