diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-11-24 09:34:53 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-11-24 09:34:53 +0400 |
| commit | c9a79464da3245af944e692bb65db5b1f71d9ef7 (patch) | |
| tree | 9554b526ee5d180f2c285ae364ea98550a781f9a /src | |
| parent | c082e2a618464f4acd30388c90f347f6d4a4effa (diff) | |
| download | niri-c9a79464da3245af944e692bb65db5b1f71d9ef7.tar.gz niri-c9a79464da3245af944e692bb65db5b1f71d9ef7.tar.bz2 niri-c9a79464da3245af944e692bb65db5b1f71d9ef7.zip | |
niri: Add a check for target screencast time below last
I've had this crash my session twice. Not sure what exactly happened.
Diffstat (limited to 'src')
| -rw-r--r-- | src/niri.rs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/niri.rs b/src/niri.rs index 4f588abf..b7b687ef 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1947,13 +1947,25 @@ impl Niri { let last = cast.last_frame_time; let min = cast.min_time_between_frames.get(); - if !last.is_zero() && target_presentation_time - last < min { - trace!( - "skipping frame because it is too soon \ - last={last:?} now={target_presentation_time:?} diff={:?} < min={min:?}", - target_presentation_time - last, + if last.is_zero() { + trace!(?target_presentation_time, ?last, "last is zero, recording"); + } else if target_presentation_time < last { + // Record frame with a warning; in case it was an overflow this will fix it. + warn!( + ?target_presentation_time, + ?last, + "target presentation time is below last, did it overflow or did we mispredict?" ); - continue; + } else { + let diff = target_presentation_time - last; + if diff < min { + trace!( + ?target_presentation_time, + ?last, + "skipping frame because it is too soon: diff={diff:?} < min={min:?}", + ); + continue; + } } { |
