Please use [CODE] tags when you post source code.
void Delay( double ms )
{
Utilities::TimerHR t;
t.StartTimer();
//int sleep = ms - 10;
//if(sleep > 0) Sleep(sleep);
while(t.GetElapsedTime() < ms){}
}
void Delay( double ms )
{
Utilities::TimerHR t;
t.StartTimer();
//int sleep = ms - 10;
//if(sleep > 0) Sleep(sleep);
while(t.GetElapsedTime() < ms){}
}
To copy to clipboard, switch view to plain text mode
This isn't a "delay" at all; instead, your CPU is just burning up cycles waiting for the loop to exit. You might as well be calculating a million digits of PI. If this is the code you are actually using in your playback loop, it's no wonder your video looks choppy. You aren't letting the CPU do anything else except ask millions of times, "Is it time yet? Is it time yet? Is it time yet?" So everything else in your playback app, like disk access, buffering, refreshing the screen, servicing mouse events, etc. has to be done in the period when the CPU isn't staring at its watch.
Replace this with a proper Qt timer, as was suggested above, and use the timeout() slot to fetch and display the next frame. Then the OS can use the time until the next timeout() to do all those things you aren't letting it do in your loop.
Bookmarks