From 2a91bec43a7a58efc22dd36e919308ecc50d9b4a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 16 Oct 2023 03:03:45 +0200 Subject: PTS: get(currentMillis): Employ rounding in integer conversion --- src/java/com/jogamp/common/av/PTS.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/java/com/jogamp/common/av/PTS.java b/src/java/com/jogamp/common/av/PTS.java index 891a323..f6edf6e 100644 --- a/src/java/com/jogamp/common/av/PTS.java +++ b/src/java/com/jogamp/common/av/PTS.java @@ -111,13 +111,13 @@ public final class PTS { /** * Returns the {@link #getLast() last updated PTS}, interpolated by {@link #getSCR() System Clock Reference (SCR)} delta to given {@code currentMillis} and playback {@link #getSpeed() speed}. *
-     *      last_pts + ( currentMillis - SCR ) * speed
+     *      last_pts + (int) ( ( currentMillis - SCR ) * speed + 0.5f )
      * 
* @param currentMillis current system clock in milliseconds, i.e. {@link Clock#currentMillis()}. * @see #set(long, int) */ public int get(final long currentMillis) { - return pts + (int) ( ( currentMillis - scr ) * speed.get() ); + return pts + (int) ( ( currentMillis - scr ) * speed.get() + 0.5f ); } /** Returns {@link #getLast()} - rhs.{@link #getLast()}. */ -- cgit v1.2.3