mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Fix pre-fetch heuristic.
This commit is contained in:
parent
393df6475e
commit
4a611d9af3
1 changed files with 3 additions and 3 deletions
|
@ -460,7 +460,6 @@ impl Future for AudioFileFetchDataReceiver {
|
|||
|
||||
fn poll(&mut self) -> Poll<(), ()> {
|
||||
loop {
|
||||
trace!("Looping data_receiver for offset {} and length {}", self.data_offset, self.request_length);
|
||||
match self.data_rx.poll() {
|
||||
Ok(Async::Ready(Some(data))) => {
|
||||
if self.measure_ping_time {
|
||||
|
@ -733,7 +732,7 @@ impl AudioFileFetch {
|
|||
full = true;
|
||||
}
|
||||
|
||||
trace!("Downloaded: {} Requested: {}", download_status.downloaded, download_status.requested);
|
||||
trace!("Downloaded: {} Requested: {}", download_status.downloaded, download_status.requested.minus(&download_status.downloaded));
|
||||
|
||||
drop(download_status);
|
||||
}
|
||||
|
@ -829,7 +828,8 @@ impl Future for AudioFileFetch {
|
|||
|
||||
let ping_time = self.shared.ping_time_ms.load(atomic::Ordering::Relaxed);
|
||||
|
||||
if bytes_pending < 2 * ping_time * self.streaming_data_rate {
|
||||
if bytes_pending < 2 * ping_time * self.streaming_data_rate / 1000 {
|
||||
trace!("Prefetching more data. pending bytes({}) < 2 * ping time ({}) * data rate({}) / 1000.",bytes_pending, ping_time, self.streaming_data_rate);
|
||||
self.pre_fetch_more_data();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue