mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
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:
parent
e92bb451b5
commit
014533a583
1 changed files with 12 additions and 10 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue