Skip to content

Commit

Permalink
[gui_play] improve UI responsiveness during playback
Browse files Browse the repository at this point in the history
  • Loading branch information
szlldm committed Jul 13, 2021
1 parent a3bde44 commit 92e3b56
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion avidemux/common/gui_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ bool GUIPlayback::run(void)

uint32_t movieTime;
uint32_t systemTime;
uint32_t lastUIpurgeTime = 0;
int32_t delta;
uint32_t fn;
bool gotAudio=true;
bool first=true;
Expand Down Expand Up @@ -308,12 +310,12 @@ bool GUIPlayback::run(void)
{
UI_purge();
UI_purge();
lastUIpurgeTime = systemTime;
refreshCounter=0;
}
}
else
{
int32_t delta;
delta=(int32_t)movieTime-(int32_t)systemTime;
// a call to whatever sleep function will last at leat 10 ms
// give some time to GTK
Expand All @@ -335,11 +337,19 @@ bool GUIPlayback::run(void)
}

UI_purge();
lastUIpurgeTime = systemTime;
refreshCounter=0;
systemTime = ticktock.getElapsedMS();
delta=(int32_t)movieTime-(int32_t)systemTime;
}
}

delta=(int32_t)systemTime-(int32_t)lastUIpurgeTime;
if (delta > 33) // ~ 30 Hz rate
{
UI_purge();
lastUIpurgeTime = systemTime;
}
}
while (!stop_req);
return true;
Expand Down

0 comments on commit 92e3b56

Please sign in to comment.