mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Avoid copying the data array in the player
This commit is contained in:
parent
48a43f4948
commit
2c187eb3ae
1 changed files with 3 additions and 5 deletions
|
@ -340,13 +340,11 @@ impl PlayerInternal {
|
||||||
let packet = decoder.as_mut().unwrap().packets().next();
|
let packet = decoder.as_mut().unwrap().packets().next();
|
||||||
|
|
||||||
match packet {
|
match packet {
|
||||||
Some(Ok(packet)) => {
|
Some(Ok(mut packet)) => {
|
||||||
let mut buffer = packet.data.to_vec();
|
|
||||||
|
|
||||||
if let Some(ref editor) = stream_editor {
|
if let Some(ref editor) = stream_editor {
|
||||||
editor.modify_stream(&mut buffer)
|
editor.modify_stream(&mut packet.data)
|
||||||
};
|
};
|
||||||
sink.write(&buffer).unwrap();
|
sink.write(&packet.data).unwrap();
|
||||||
|
|
||||||
self.update(|state| {
|
self.update(|state| {
|
||||||
state.position_ms = vorbis_time_tell_ms(decoder.as_mut().unwrap()).unwrap() as u32;
|
state.position_ms = vorbis_time_tell_ms(decoder.as_mut().unwrap()).unwrap() as u32;
|
||||||
|
|
Loading…
Reference in a new issue