Skip to content

Commit

Permalink
secondsAhead
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosty-J authored and SimonIT committed Mar 30, 2024
1 parent 7b13ad6 commit 4492f8b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,17 @@ public boolean update () {
}

isFirstFrame = false;
double millisecondsAhead;
double secondsAhead;
if (audio == null) {
float deltaTime = Gdx.graphics.getDeltaTime();
// Avoid huge delta time if game execution has been suspended
if (deltaTime >= 1f) deltaTime = 1f / Gdx.graphics.getDisplayMode().refreshRate;
currentVideoTime += deltaTime;
millisecondsAhead = decoder.getCurrentFrameTimestamp() - currentVideoTime;
secondsAhead = decoder.getCurrentFrameTimestamp() - currentVideoTime;
} else {
millisecondsAhead = decoder.getCurrentFrameTimestamp() - audio.getPosition();
secondsAhead = decoder.getCurrentFrameTimestamp() - audio.getPosition();
}
showAlreadyDecodedFrame = millisecondsAhead > .02f;
showAlreadyDecodedFrame = secondsAhead > .02f;
return newFrame;
}
return false;
Expand Down

0 comments on commit 4492f8b

Please sign in to comment.