File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -186,10 +186,9 @@ impl Player {
186
186
}
187
187
}
188
188
const PRELOAD_BEFORE_END_OF_TRACK : Duration = Duration :: from_secs ( 30 ) ;
189
- if let Some ( & item_to_preload) = self . queue . get_following ( ) {
190
- let time_until_end_of_track =
191
- path. duration . checked_sub ( new_position) . unwrap_or_default ( ) ;
192
- if time_until_end_of_track <= PRELOAD_BEFORE_END_OF_TRACK {
189
+ let time_until_end_of_track = path. duration . checked_sub ( new_position) . unwrap_or_default ( ) ;
190
+ if time_until_end_of_track <= PRELOAD_BEFORE_END_OF_TRACK {
191
+ if let Some ( & item_to_preload) = self . queue . get_following ( ) {
193
192
self . preload ( item_to_preload) ;
194
193
}
195
194
}
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ impl DecoderSource {
105
105
let total_samples = cp. n_frames . unwrap ( ) * chan_count as u64 ;
106
106
let time_base = cp. time_base . unwrap ( ) ;
107
107
let precision =
108
- REPORT_PRECISION . as_millis ( ) as u64 / ( signal_spec . rate as u64 * chan_count as u64 ) ;
108
+ ( signal_spec . rate as f64 * chan_count as f64 * REPORT_PRECISION . as_secs_f64 ( ) ) as u64 ;
109
109
110
110
// Create a ring-buffer for the decoded samples. Worker thread is producing,
111
111
// we are consuming in the `AudioSource` impl.
You can’t perform that action at this time.
0 commit comments