Disable frame accurate replay playback (#5316)

Disable frame accurate replay playback
This commit is contained in:
Dean Herbert 2019-07-11 23:09:54 +09:00 committed by GitHub
commit 6c8cf193bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Replays;
@ -9,7 +10,7 @@
namespace osu.Game.Tests.NonVisual
{
[TestFixture]
public class FramedReplayinputHandlerTest
public class FramedReplayInputHandlerTest
{
private Replay replay;
private TestInputHandler handler;
@ -160,10 +161,7 @@ public void TestBasicRewind()
[Test]
public void TestRewindInsideImportantSection()
{
// fast forward to important section
while (handler.SetFrameFromTime(3000) != null)
{
}
fastForwardToPoint(3000);
setTime(4000, 4000);
confirmCurrentFrame(4);
@ -205,10 +203,7 @@ public void TestRewindInsideImportantSection()
[Test]
public void TestRewindOutOfImportantSection()
{
// fast forward to important section
while (handler.SetFrameFromTime(3500) != null)
{
}
fastForwardToPoint(3500);
confirmCurrentFrame(3);
confirmNextFrame(4);
@ -227,6 +222,15 @@ public void TestRewindOutOfImportantSection()
confirmNextFrame(2);
}
private void fastForwardToPoint(double destination)
{
for (int i = 0; i < 1000; i++)
if (handler.SetFrameFromTime(destination) == null)
return;
throw new TimeoutException("Seek was never fulfilled");
}
private void setTime(double set, double? expect)
{
Assert.AreEqual(expect, handler.SetFrameFromTime(set));
@ -274,6 +278,7 @@ private class TestInputHandler : FramedReplayInputHandler<TestReplayFrame>
public TestInputHandler(Replay replay)
: base(replay)
{
FrameAccuratePlayback = true;
}
protected override double AllowedImportantTimeSpan => 1000;

View File

@ -84,7 +84,7 @@ private bool advanceFrame()
/// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data.
/// Disabling this can make replay playback smoother (useful for autoplay, currently).
/// </summary>
public bool FrameAccuratePlayback = true;
public bool FrameAccuratePlayback = false;
protected bool HasFrames => Frames.Count > 0;