mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Merge pull request #194 from brain0/fix_pulseaudio
Fix pulseaudio playback with Lewton
This commit is contained in:
commit
cb61e222d7
2 changed files with 13 additions and 10 deletions
|
@ -112,6 +112,7 @@ impl Sink for PulseAudioSink {
|
||||||
} else {
|
} else {
|
||||||
let ptr = data.as_ptr() as *const libc::c_void;
|
let ptr = data.as_ptr() as *const libc::c_void;
|
||||||
let len = data.len() as usize * mem::size_of::<i16>();
|
let len = data.len() as usize * mem::size_of::<i16>();
|
||||||
|
assert!(len > 0);
|
||||||
call_pulseaudio(
|
call_pulseaudio(
|
||||||
|err| unsafe { pa_simple_write(self.s, ptr, len, err) },
|
|err| unsafe { pa_simple_write(self.s, ptr, len, err) },
|
||||||
|ret| ret < 0,
|
|ret| ret < 0,
|
||||||
|
|
|
@ -372,6 +372,7 @@ impl PlayerInternal {
|
||||||
fn handle_packet(&mut self, packet: Option<VorbisPacket>, normalisation_factor: f32) {
|
fn handle_packet(&mut self, packet: Option<VorbisPacket>, normalisation_factor: f32) {
|
||||||
match packet {
|
match packet {
|
||||||
Some(mut packet) => {
|
Some(mut packet) => {
|
||||||
|
if packet.data().len() > 0 {
|
||||||
if let Some(ref editor) = self.audio_filter {
|
if let Some(ref editor) = self.audio_filter {
|
||||||
editor.modify_stream(&mut packet.data_mut())
|
editor.modify_stream(&mut packet.data_mut())
|
||||||
};
|
};
|
||||||
|
@ -387,6 +388,7 @@ impl PlayerInternal {
|
||||||
self.stop_sink();
|
self.stop_sink();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
None => {
|
None => {
|
||||||
self.stop_sink();
|
self.stop_sink();
|
||||||
|
|
Loading…
Reference in a new issue