[vlc-commits] clock: check condition before calculation
Zhao Zhili
git at videolan.org
Fri May 22 09:03:03 CEST 2020
vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Wed May 20 23:28:04 2020 +0800| [fa1d0ea16d1d519523519592a58e0ba5fa473c4f] | committer: Thomas Guillem
clock: check condition before calculation
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fa1d0ea16d1d519523519592a58e0ba5fa473c4f
---
src/clock/clock.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/clock/clock.c b/src/clock/clock.c
index f373460abe..26e380b439 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -132,12 +132,12 @@ static vlc_tick_t vlc_clock_master_update(vlc_clock_t *clock,
if (main_clock->offset != VLC_TICK_INVALID
&& ts != main_clock->last.stream)
{
- /* We have a reference so we can update coeff */
- double instant_coeff = (system_now - main_clock->last.system)
- / (double)(ts - main_clock->last.stream);
if (rate == main_clock->rate)
{
- instant_coeff *= rate;
+ /* We have a reference so we can update coeff */
+ double instant_coeff = (system_now - main_clock->last.system)
+ / (double)(ts - main_clock->last.stream)
+ * rate;
AvgUpdate(&main_clock->coeff_avg, instant_coeff);
main_clock->coeff = AvgGet(&main_clock->coeff_avg);
}
More information about the vlc-commits
mailing list