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.
This commit is contained in:
François Laignel 2022-09-12 17:39:52 +02:00 committed by Sebastian Dröge
parent cc0ef5290f
commit 2355be1cef

View file

@ -872,9 +872,11 @@ impl SrcHandler {
return (now, None); return (now, None);
} }
let next_wakeup = state let next_wakeup = state.earliest_pts.map(|earliest_pts| {
.earliest_pts (earliest_pts + latency)
.map(|earliest_pts| earliest_pts + latency - state.packet_spacing - context_wait / 2); .saturating_sub(state.packet_spacing)
.saturating_sub(context_wait / 2)
});
let delay = next_wakeup let delay = next_wakeup
.opt_saturating_sub(now) .opt_saturating_sub(now)