playback: Only send a packet to the audio backend if it isn't empty

The lewton decoder sometimes delivers empty packets, especially after skipping inside a
track or switching tracks. This caused the pulseaudio backend to fail since it expects
a non-empty packet. There is no need to handle empty packets in the audio backend, so
we can skip them entirely.
This commit is contained in:
Thomas Bächler 2018-03-20 14:01:15 +01:00
parent e92bb451b5
commit 014533a583

View file

@ -372,6 +372,7 @@ impl PlayerInternal {
fn handle_packet(&mut self, packet: Option<VorbisPacket>, normalisation_factor: f32) {
match packet {
Some(mut packet) => {
if packet.data().len() > 0 {
if let Some(ref editor) = self.audio_filter {
editor.modify_stream(&mut packet.data_mut())
};
@ -387,6 +388,7 @@ impl PlayerInternal {
self.stop_sink();
}
}
}
None => {
self.stop_sink();