[vlc-devel] [PATCH] clock: fix AvgRescale
Zhao Zhili
quinkblack at foxmail.com
Sat Aug 25 07:30:13 CEST 2018
The average value (or expected value) doesn't dependent on the sample
window length.
---
src/clock/clock_internal.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/clock/clock_internal.c b/src/clock/clock_internal.c
index 49711cbf01..fa6ee93e94 100644
--- a/src/clock/clock_internal.c
+++ b/src/clock/clock_internal.c
@@ -68,9 +68,6 @@ vlc_tick_t AvgGet( average_t *p_avg )
void AvgRescale( average_t *p_avg, int i_divider )
{
- const vlc_tick_t i_tmp = p_avg->i_value * p_avg->i_divider + p_avg->i_residue;
-
+ p_avg->i_residue = (int64_t)i_divider * p_avg->i_residue / p_avg->i_divider;
p_avg->i_divider = i_divider;
- p_avg->i_value = i_tmp / p_avg->i_divider;
- p_avg->i_residue = i_tmp % p_avg->i_divider;
}
--
2.18.0
More information about the vlc-devel
mailing list