I tried to modify the heartbeat and media playback sleep times so that they only sleep once per frame, but this didn’t seem to be a problem. Is there any other effect if I adjust to double or based on frame rate? What UE is set to 5ms and 6.25ms by default?
uint32 FMediaTicker::Run()
{
while (!Stopping)
{
if (WakeupEvent->Wait(FTimespan::MaxValue()))
{
TickTickables();
FPlatformProcess::Sleep(0.005f);
}
}
return 0;
}
/* Maximum rate the rendering thread will tick tickables when idle (in Hz)
float GRenderingThreadMaxIdleTickFrequency = 40.f;
1.0f/160 = 6.25ms
*/
virtual uint32 Run(void)
{
while(GRunRenderingThreadHeartbeat)
{
FPlatformProcess::Sleep(1.0f /(4.0f * GRenderingThreadMaxIdleTickFrequency));
if (!GIsRenderingThreadSuspended && OutstandingHeartbeats.GetValue() < 4)
{
OutstandingHeartbeats.Increment();
ENQUEUE_UNIQUE_RENDER_COMMAND(
HeartbeatTickTickables,
{
OutstandingHeartbeats.Decrement();
// make sure that rendering thread tickables get a chance to tick, even if the render thread is starving
if (!GIsRenderingThreadSuspended)
{
TickRenderingTickables();
}
});
}
}
return 0;
}