Skip to content

Commit

Permalink
skip frames when playing back IVF to prevent desyncs
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and madame-rachelle committed Apr 18, 2024
1 parent 5b2673f commit 64ffe9b
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/common/cutscenes/movieplayer.cpp
Expand Up @@ -554,21 +554,34 @@ class VpxPlayer : public MoviePlayer
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;
nextframetime += nsecsperframe;

while(clock >= nextframetime)
{ // frameskipping
auto img = GetFrameData();
framenum++;
nextframetime += nsecsperframe;
if (framenum >= numframes || !img) break;
}
else

if (framenum < numframes)
{
animtex.SetFrame(nullptr, img);
}
auto img = GetFrameData();

framenum++;
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);
Expand Down

0 comments on commit 64ffe9b

Please sign in to comment.