Merge pull request #905 from roderickvd/fix-exit-on-decoder-error

Skip track on decoding error
This commit is contained in:
Roderick van Domburg 2021-12-15 19:01:15 +01:00 committed by GitHub
commit 1736e7c52b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {