Count the frame number in driver thread

In order to add labels for each frame number, we also need a frame
number in the driver thread, so the monotonic increased frame number
should be moved into the driver thread.