mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-04 10:19:27 +02:00
Merge branch 'dynamic-blocks' into comments
This commit is contained in:
commit
1fcacf78cd
50 changed files with 5354 additions and 3522 deletions
|
@ -12,9 +12,9 @@ use std::time::{Duration, Instant};
|
|||
use tempfile::NamedTempFile;
|
||||
use range_set::{Range, RangeSet};
|
||||
|
||||
use core::channel::{Channel, ChannelData, ChannelError, ChannelHeaders};
|
||||
use core::session::Session;
|
||||
use core::spotify_id::FileId;
|
||||
use librespot_core::channel::{Channel, ChannelData, ChannelError, ChannelHeaders};
|
||||
use librespot_core::session::Session;
|
||||
use librespot_core::spotify_id::FileId;
|
||||
use futures::sync::mpsc::unbounded;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
|
@ -68,7 +68,7 @@ impl StreamLoaderController {
|
|||
|
||||
pub fn range_available(&self, range: Range) -> bool {
|
||||
if let Some(ref shared) = self.stream_shared {
|
||||
let mut download_status = shared.download_status.lock().unwrap();
|
||||
let download_status = shared.download_status.lock().unwrap();
|
||||
if range.length <= download_status.downloaded.contained_length_from_value(range.start) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -219,7 +219,7 @@ impl AudioFileOpenStreaming {
|
|||
});
|
||||
|
||||
let mut write_file = NamedTempFile::new().unwrap();
|
||||
write_file.set_len(size as u64).unwrap();
|
||||
write_file.as_file().set_len(size as u64).unwrap();
|
||||
write_file.seek(SeekFrom::Start(0)).unwrap();
|
||||
|
||||
let read_file = write_file.reopen().unwrap();
|
||||
|
@ -483,7 +483,7 @@ impl Future for AudioFileFetchDataReceiver {
|
|||
Ok(Async::Ready(Some(data))) => {
|
||||
if let Some(request_sent_time) = self.request_sent_time {
|
||||
let duration = Instant::now() - request_sent_time;
|
||||
let mut duration_ms: u64;
|
||||
let duration_ms: u64;
|
||||
if duration.as_secs() > MAXIMUM_ASSUMED_PING_TIME_SECONDS {
|
||||
duration_ms = MAXIMUM_ASSUMED_PING_TIME_SECONDS * 1000;
|
||||
}else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue