diff options
author | François Laignel <fengalin@free.fr> | 2022-09-12 18:39:52 +0300 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2022-09-12 21:42:34 +0300 |
commit | 2355be1cefe3d2ee8d7df1a6e9bf0d3aec2c39ff (patch) | |
tree | 6eced0b2c006e1f32df5b5e110583b3cac923463 /generic | |
parent | cc0ef5290fb8849e86deddb36d202b70590d6199 (diff) |
ts/jitterbuffer: extra robustness for Windows CI
jitterbuffer tests crash on Windows CI sometimes. Activating logs
showed time values which are probably not expected in a regular
environment, but which can happen there. Adding extra robustness
to `next_wakeup` computation seems to fix the problem judging by
the few runs I triggered.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/threadshare/src/jitterbuffer/imp.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/threadshare/src/jitterbuffer/imp.rs b/generic/threadshare/src/jitterbuffer/imp.rs index 699f7df5d..3499e8912 100644 --- a/generic/threadshare/src/jitterbuffer/imp.rs +++ b/generic/threadshare/src/jitterbuffer/imp.rs @@ -872,9 +872,11 @@ impl SrcHandler { return (now, None); } - let next_wakeup = state - .earliest_pts - .map(|earliest_pts| earliest_pts + latency - state.packet_spacing - context_wait / 2); + let next_wakeup = state.earliest_pts.map(|earliest_pts| { + (earliest_pts + latency) + .saturating_sub(state.packet_spacing) + .saturating_sub(context_wait / 2) + }); let delay = next_wakeup .opt_saturating_sub(now) |