Browse Source

Speed up playback by avoiding unnecessary seek when playing from the beginning of a file.

Konstantin Seiler 6 years ago
parent
commit
2e492e4d44
1 changed files with 6 additions and 3 deletions
  1. 6 3
      playback/src/player.rs

+ 6 - 3
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);