Solved speed issue
By distributing loads more balanced between the main thread and the
server thread, it seems speed issue is solved.
Now, main thread only saves screenshots. It is the server thread
that writes and reads from buffer.