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 let key = self
.session .session
.audio_key() .audio_key()
.request(track.id, file_id) .request(track.id, file_id);
.wait() let encrypted_file = AudioFile::open(&self.session, file_id);
.unwrap();
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 mut decrypted_file = AudioDecrypt::new(key, encrypted_file);
let normalisation_factor = match NormalisationData::parse_from_file(&mut decrypted_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(); let mut decoder = VorbisDecoder::new(audio_file).unwrap();
match decoder.seek(position) { if position != 0 {
Ok(_) => (), match decoder.seek(position) {
Err(err) => error!("Vorbis error: {:?}", err), Ok(_) => (),
Err(err) => error!("Vorbis error: {:?}", err),
}
} }
info!("Track \"{}\" loaded", track.name); info!("Track \"{}\" loaded", track.name);