mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 08:01:50 +00:00
skip frames when playing back IVF to prevent desyncs
This commit is contained in:
parent
5b2673f469
commit
64ffe9b97b
1 changed files with 24 additions and 11 deletions
|
@ -554,21 +554,34 @@ public:
|
|||
bool stop = false;
|
||||
if (clock >= nextframetime)
|
||||
{
|
||||
|
||||
|
||||
nextframetime += nsecsperframe;
|
||||
|
||||
auto img = GetFrameData();
|
||||
|
||||
if (!img || !FormatSupported(img->fmt))
|
||||
{
|
||||
Printf(PRINT_BOLD, "Failed reading next frame\n");
|
||||
stop = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
animtex.SetFrame(nullptr, img);
|
||||
while(clock >= nextframetime)
|
||||
{ // frameskipping
|
||||
auto img = GetFrameData();
|
||||
framenum++;
|
||||
nextframetime += nsecsperframe;
|
||||
if (framenum >= numframes || !img) break;
|
||||
}
|
||||
|
||||
framenum++;
|
||||
if (framenum < numframes)
|
||||
{
|
||||
auto img = GetFrameData();
|
||||
|
||||
if (!img || !FormatSupported(img->fmt))
|
||||
{
|
||||
Printf(PRINT_BOLD, "Failed reading next frame\n");
|
||||
stop = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
animtex.SetFrame(nullptr, img);
|
||||
}
|
||||
|
||||
framenum++;
|
||||
}
|
||||
if (framenum >= numframes) stop = true;
|
||||
|
||||
bool nostopsound = (flags & NOSOUNDCUTOFF);
|
||||
|
|
Loading…
Reference in a new issue