Time left for display to be updated
I'm developping a video software where a video is shown to a test subject and after a while some effects are added to the video and the subject's reaction is measured. To make this possible I need a log file that gives with millisecond precision the moment that the effect is applied to the video and shown to the person. The problem is that due to the 60Hz refresh rate of the display, the applied effect cannot be actually seen on the screen at the same moment it's applied. I was wondering if there's a way to get the time left for the screen to be updated again so I can wait before writing to the log file? I would be thankful if anyone could help me, thanks.
Maybe if we had some information about "how" your are trying to display the video we might come up with idea's. On the other hand, the 60 Hz refresh rate is only what you "desire" and up to the OS to display, but if the OS is a bit busy you might only get 40Hz refreshrate. Maybe there are signals in the widget you use that are emitted when a new "screen write" is initiated, but a bit more information on your code would be handy. Post some code along with it.
The videodata is coming from a video camera. To display a frame I'm simply using a QLabel:
QImage qImg((uchar*)imBuf, VIDEO_WIDTH, VIDEO_HEIGHT, QImage::Format_RGB888);
Now after this piece of code I'm supposed to write to the log file, but it might take up to 16ms to actually see the new frame.