[vlc-devel] [PATCH] timer: fix possible missed interval/delay in the timer
Steve Lhomme
robux4 at ycbcr.xyz
Wed Jan 30 14:41:07 CET 2019
Due to rounding errors. For example an interval of 999 ticks will give a 0
interval in the end.
---
src/win32/timer.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/win32/timer.c b/src/win32/timer.c
index e9f78c1b11..4fe3d2b067 100644
--- a/src/win32/timer.c
+++ b/src/win32/timer.c
@@ -80,9 +80,15 @@ void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
value = 0;
}
+ DWORD val = MS_FROM_VLC_TICK(value);
+ DWORD interv = MS_FROM_VLC_TICK(interval);
+ if (val == 0 && value != 0)
+ val = 1; /* rounding error */
+ if (interv == 0 && interval != 0)
+ interv = 1; /* rounding error */
+
if (!CreateTimerQueueTimer(&timer->handle, NULL, vlc_timer_do, timer,
- MS_FROM_VLC_TICK(value),
- MS_FROM_VLC_TICK(interval), WT_EXECUTEDEFAULT))
+ val, interv, WT_EXECUTEDEFAULT))
abort ();
}
--
2.17.1
More information about the vlc-devel
mailing list