Fix for audio and video sync: subtracting processing time from thread's
sleep time (for every frame)