From 2e492e4d4478f00ccc24da3538e19b66eb33c861 Mon Sep 17 00:00:00 2001 From: Konstantin Seiler Date: Sat, 9 Mar 2019 19:30:27 +1100 Subject: [PATCH] Speed up playback by avoiding unnecessary seek when playing from the beginning of a file. --- playback/src/player.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/playback/src/player.rs b/playback/src/player.rs index 3841e35f..d4b55329 100644 --- a/playback/src/player.rs +++ b/playback/src/player.rs @@ -580,9 +580,12 @@ impl PlayerInternal { let mut decoder = VorbisDecoder::new(audio_file).unwrap(); - match decoder.seek(position) { - Ok(_) => (), - Err(err) => error!("Vorbis error: {:?}", err), + if position != 0 { + info!("seek {}", position); + match decoder.seek(position) { + Ok(_) => (), + Err(err) => error!("Vorbis error: {:?}", err), + } } info!("Track \"{}\" loaded", track.name);