I have wrote a small algorithm to automatically change Jpeg compression in Tight to optimize video restitution (reduce Jpeg compression when you play a video).
Works nice with UltraVNC, TightVNC, x11vnc… (not with RealVNC, of course, because they don’t support tight.
But it didn’t work with Vine : the server hangs after a few seconds (hangs, don’t crash).
I suspect a lock problem between the threads and I had a look in the code.
An analysis with Apple Instruments shows the following result :
_ thread _pthread_start : waits in listenerRun() - accept()
_ thread _pthread_cond_wait : waits in clientOutput() - semaphore_wait_signal_trap
_ thread _pthread_start waits in : clientInput() -> rfbProcessClientNormalMessage() -> rfbLog() -> NSLogv and so on in the framework
_ thread MainThread waits in refreshCallback() -> semaphore_wait_signal_trap
Looks like the logger blocks and hangs everything. Is it a known issue ?
I will try to add a workaround : add a nolog parameter on the server to avoid logging … Should fix the problem.
I have added a -disableLog parameter and recompiled it. Now it works fine!
It is not a real fix, since I think this is a MacOsX bug, or a protection to avoid that an application flood system logs.
A real fix would be to add a mechanism to avoid to log more than 10 logs per second, for instance … Or to better understand system restrictions on logging.
// OSXvnc 0.8 This flag will use a local buffer which will allow us to display the mouse cursor
// Bool rfbLocalBuffer = FALSE;
@@ -134,16 +135,18 @@
*/
void rfbDebugLog(char *format, …) {
@@ -740,7 +743,7 @@
fprintf(stderr, " (default: no, process them)
");
fprintf(stderr, "-disableRichClipboards Don’t share rich clipboard events
");
fprintf(stderr, " (default: no, process them)
");
fprintf(stderr, "-connectHost host Host Name or IP of listening client to establishing a reverse conneect
");
fprintf(stderr, "-connectHost host Host Name or IP of listening client to establishing a reverse connect
");
fprintf(stderr, "-connectPort port TCP port of listening client to establishing a reverse conneect
");
fprintf(stderr, " (default: 5500)
");
fprintf(stderr, "-noupdates Prevent registering for screen updates, for use with x2vnc or win2vnc
");
@@ -750,6 +753,7 @@
fprintf(stderr, " (default: detect)
");
fprintf(stderr, "-littleEndian Force Little-Endian mode (INTEL)
");
fprintf(stderr, " (default: detect)
");
fprintf(stderr, "-disableLog Don’t log anything in console
");