Skip to content

Commit 67b6ee5

Browse files
committed
fix: fix buffering status and maybe catch up properly
1 parent e7f64ca commit 67b6ee5

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎player/src/audio.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,18 @@ impl AudioThread {
282282
AudioData::Start => {
283283
self.wants_play = true;
284284
self.p.fake_frames_received(0);
285-
let _ = self.tx.send(AudioStatus::Buffering(true));
285+
286+
// if we don't have enough buffer yet, wait
287+
// otherwise we had extra so we can just keep playing i guess?
288+
// TODO: maybe this threshold should be lower so we can catch up only when we're actually low instead of every time we get a little low??
289+
if !self.p.is_ready() {
290+
let _ = self.tx.send(AudioStatus::Buffering(true));
291+
292+
// if we're continuing from another song, pause until we have enough
293+
if self.p.is_started() {
294+
self.p.pause();
295+
}
296+
}
286297
}
287298
AudioData::Finish => {
288299
while !self.p.finish() {

0 commit comments

Comments
 (0)