From 2c187eb3aed3311b79470fb04e7aa3e71e7eb5af Mon Sep 17 00:00:00 2001 From: Daniel Romero Date: Fri, 3 Feb 2017 11:05:52 +0100 Subject: [PATCH] Avoid copying the data array in the player --- src/player.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/player.rs b/src/player.rs index 5a4f0c98..aad23dfa 100644 --- a/src/player.rs +++ b/src/player.rs @@ -340,13 +340,11 @@ impl PlayerInternal { let packet = decoder.as_mut().unwrap().packets().next(); match packet { - Some(Ok(packet)) => { - let mut buffer = packet.data.to_vec(); - + Some(Ok(mut packet)) => { 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| { state.position_ms = vorbis_time_tell_ms(decoder.as_mut().unwrap()).unwrap() as u32;