Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 12, 2024
1 parent 5f7291c commit 4376718
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions crates/viewer/re_renderer/src/video/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand All @@ -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,
})
}
}

Expand Down

0 comments on commit 4376718

Please sign in to comment.