[Qt-interest] QTimer on Windows in Unreliable for Small (16ms - 30ms) Delays
Josiah Bryan
jbryan at productiveconcepts.com
Sat Sep 5 05:10:08 CEST 2009
I realize I may be out of line here and this may not be
"feasible"....but, I'll ask anyway!
I'm trying to do video playback with Qt. (The end goal is some video
with text over top - song lyrics for church and the like.) I'm using
ffmpeg (libavcodec, etc) as the decoder. No problems there - works
great. The problem comes in getting the frame onto the screen in a
timely fashion.
I've got the code to compute the optimal delay between frames, based on
elapsed time, etc. It normally works out to around 33ms for a 30 fps
video. I set a timer that throws a signal once the time is up for that
frame. The other end of that signal just draws the frame.
The problem, specifically, is that about once every 20 - 60 frames, the
timer wacks out and doesn't fire for around 1000 ms - no where *near*
the requested 30ms or whatever.
I'm just doing:
QTimer::singleShot(actual_delay, this, SLOT(displayFrame()));
I've tried *everything* I can think of to figure out why its randomly
taking way longer than requested - raised the priority of the executable
thru task manager, using a QTimer object instead of
QTimer::singleShot(), any other misc ideas I can think of. I've been
googling for *everything* - no answers, nothing seems to help. I've even
seen metion of something like qt_win_simple_timers or something like
that - compile errors, didn't help. I tried using windows timer queues -
I forget the function names - but compile errors there.
Anyway, anyone have any ideas? Or, even alternatives to playing videos
in QT? (Phonon isn't working for me.)
Thanks,
-josiah
More information about the Qt-interest-old
mailing list