From: Kostya Shishkov Date: Sat, 14 Feb 2026 19:42:12 +0000 (+0100) Subject: videoplayer: limit prefill iterations in case something goes wrong X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;p=nihav-player.git videoplayer: limit prefill iterations in case something goes wrong --- diff --git a/videoplayer/src/main.rs b/videoplayer/src/main.rs index 83e162b..b06cb53 100644 --- a/videoplayer/src/main.rs +++ b/videoplayer/src/main.rs @@ -571,7 +571,8 @@ impl Player { debug_log!(self; {" prefilling"}); let mut got_video = !self.has_video; let mut got_audio = !self.has_audio; - while !(got_video && got_audio) { + let mut iters = 0; + while !(got_video && got_audio) && iters < 10 { // phase 1 - try to send packets for decoding loop { let mut try_send = self.acontrol.get_queue_size() < FRAME_QUEUE_LEN && (!self.has_video || (!self.vcontrol.is_filled(FRAME_QUEUE_LEN) && !disp_queue.is_full())); @@ -622,6 +623,7 @@ impl Player { if self.has_audio && self.acontrol.get_fill() > 0 { got_audio = true; } + iters += 1; } debug_log!(self; {format!(" prefilling done, frames {}-{} audio {}", disp_queue.start, disp_queue.end, self.acontrol.get_fill())}); Ok(())