Merge pull request #297 from kaymes/kaymes-faster

Improve playback speed
This commit is contained in:
Sasha Hilton 2019-03-13 23:45:20 +01:00 committed by GitHub
commit 806a8f2da5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -560,12 +560,12 @@ impl PlayerInternal {
let key = self
.session
.audio_key()
.request(track.id, file_id)
.wait()
.unwrap();
.request(track.id, file_id);
let encrypted_file = AudioFile::open(&self.session, file_id);
let encrypted_file = AudioFile::open(&self.session, file_id).wait().unwrap();
let encrypted_file = encrypted_file.wait().unwrap();
let key = key.wait().unwrap();
let mut decrypted_file = AudioDecrypt::new(key, encrypted_file);
let normalisation_factor = match NormalisationData::parse_from_file(&mut decrypted_file) {
@ -580,9 +580,11 @@ impl PlayerInternal {
let mut decoder = VorbisDecoder::new(audio_file).unwrap();
match decoder.seek(position) {
Ok(_) => (),
Err(err) => error!("Vorbis error: {:?}", err),
if position != 0 {
match decoder.seek(position) {
Ok(_) => (),
Err(err) => error!("Vorbis error: {:?}", err),
}
}
info!("Track \"{}\" loaded", track.name);