diff options
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) |