Avoid copying the data array in the player

This commit is contained in:
Daniel Romero 2017-02-03 11:05:52 +01:00
parent 48a43f4948
commit 2c187eb3ae

View file

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