diff --git a/crates/viewer/re_renderer/src/video/player.rs b/crates/viewer/re_renderer/src/video/player.rs index 4d495558e2c6..f449ed8903b6 100644 --- a/crates/viewer/re_renderer/src/video/player.rs +++ b/crates/viewer/re_renderer/src/video/player.rs @@ -144,33 +144,33 @@ impl VideoPlayer { let time_range = frame_info.presentation_time_range(); let is_active_frame = time_range.contains(&presentation_timestamp); - let is_pending = !is_active_frame; + let is_pending = !is_active_frame; let show_spinner = if is_pending && error_on_last_frame_at { - // If we switched from error to pending, clear the texture. - // This is important to avoid flickering, in particular when switching from - // benign errors like DecodingError::NegativeTimestamp. - // If we don't do this, we see the last valid texture which can look really weird. - clear_texture(render_ctx, &self.video_texture.texture); + // If we switched from error to pending, clear the texture. + // This is important to avoid flickering, in particular when switching from + // benign errors like DecodingError::NegativeTimestamp. + // If we don't do this, we see the last valid texture which can look really weird. + clear_texture(render_ctx, &self.video_texture.texture); self.video_texture.frame_info = None; true } else if presentation_timestamp < time_range.start { - // We're seeking backwards and somehow forgot to reset. - true - } else if presentation_timestamp < time_range.end { - false // it is an active frame + // We're seeking backwards and somehow forgot to reset. + true + } else if presentation_timestamp < time_range.end { + false // it is an active frame + } else { + let how_outdated = presentation_timestamp - time_range.end; + if how_outdated.duration(self.data.timescale) < DECODING_GRACE_DELAY { + false // Just outdated by a little bit - show no spinner } else { - let how_outdated = presentation_timestamp - time_range.end; - if how_outdated.duration(self.data.timescale) < DECODING_GRACE_DELAY { - false // Just outdated by a little bit - show no spinner - } else { - true // Very old frame - show spinner - } - }; - Ok(VideoFrameTexture { - texture: self.video_texture.texture.clone(), - is_pending, - show_spinner, + true // Very old frame - show spinner + } + }; + Ok(VideoFrameTexture { + texture: self.video_texture.texture.clone(), + is_pending, + show_spinner, frame_info: Some(frame_info), source_pixel_format: self.video_texture.source_pixel_format, }) @@ -180,8 +180,8 @@ impl VideoPlayer { is_pending: true, show_spinner: true, frame_info: None, - source_pixel_format: self.video_texture.source_pixel_format, - }) + source_pixel_format: self.video_texture.source_pixel_format, + }) } }