mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #905 from roderickvd/fix-exit-on-decoder-error
Skip track on decoding error
This commit is contained in:
commit
1736e7c52b
1 changed files with 24 additions and 8 deletions
|
@ -737,7 +737,14 @@ impl PlayerTrackLoader {
|
|||
}
|
||||
};
|
||||
|
||||
assert!(audio.duration >= 0);
|
||||
if audio.duration < 0 {
|
||||
error!(
|
||||
"Track duration for <{}> cannot be {}",
|
||||
spotify_id.to_uri(),
|
||||
audio.duration
|
||||
);
|
||||
return None;
|
||||
}
|
||||
let duration_ms = audio.duration as u32;
|
||||
|
||||
// (Most) podcasts seem to support only 96 bit Vorbis, so fall back to it
|
||||
|
@ -943,9 +950,12 @@ impl Future for PlayerInternal {
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
Poll::Ready(Err(_)) => {
|
||||
warn!("Unable to load <{:?}>\nSkipping to next track", track_id);
|
||||
assert!(self.state.is_loading());
|
||||
Poll::Ready(Err(e)) => {
|
||||
warn!(
|
||||
"Skipping to next track, unable to load track <{:?}>: {:?}",
|
||||
track_id, e
|
||||
);
|
||||
debug_assert!(self.state.is_loading());
|
||||
self.send_event(PlayerEvent::EndOfTrack {
|
||||
track_id,
|
||||
play_request_id,
|
||||
|
@ -1045,8 +1055,11 @@ impl Future for PlayerInternal {
|
|||
}
|
||||
}
|
||||
Err(e) => {
|
||||
error!("PlayerInternal poll: {}", e);
|
||||
exit(1);
|
||||
warn!("Skipping to next track, unable to decode samples for track <{:?}>: {:?}", track_id, e);
|
||||
self.send_event(PlayerEvent::EndOfTrack {
|
||||
track_id,
|
||||
play_request_id,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1058,8 +1071,11 @@ impl Future for PlayerInternal {
|
|||
self.handle_packet(packet, normalisation_factor);
|
||||
}
|
||||
Err(e) => {
|
||||
error!("PlayerInternal poll: {}", e);
|
||||
exit(1);
|
||||
warn!("Skipping to next track, unable to get next packet for track <{:?}>: {:?}", track_id, e);
|
||||
self.send_event(PlayerEvent::EndOfTrack {
|
||||
track_id,
|
||||
play_request_id,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue