Closed gelisam closed 6 years ago
To be sure I understand, the point here is that using the IORef
lets us include the ffmpeg frame decode in our inter-frame timing, whereas previously we were effectively timing only the inner loop?
Ah! That wasn't the goal, no, but now that you point it out, yes, that's what the code is doing!
My goal was to include everything going on inside the frame, not just the bits which we think are costly. I previously thought that renderTexture
was also decoding the next frame, so the only thing which wasn't being measured was this nothingOnQuit
function. I thought that function was only polling for events and should thus complete super-quickly, but including it in the measurement fixed the problem, and that was good enough for me. Now that you point out that this function is also decoding the next frame, I finally understand why my fix works :)
Thank you!
On my computer,
vplay
's fps was visibly incorrect, and videos looked like they were being played on slow motion. This fixes the problem by measuring the duration of the entire frame, not just the costlyrenderTexture
call.