OpenKinect/libfreenect — Issue #273: cppwrapper: HUGE delay initializing device
Author: rennox
Created: 2012-02-23 03:34:13+00:00
State: open

I'm working on a cpp project using the wrapper and since I begun, noted that it takes a variable time to initialize the device. Going from seconds.... to 5+ minutes.

At the beggining I just ignored it... though the more tests I want to do, the more annoying it is.

Reviewed the sample projects... and found there the initialization is pretty quick... so decided to investigate a little more and found this:

ON THE WRAPPER
---------------------------

right on the creation of the Freenect object which will be used to create the device object a thread is created (pthread_callback) which will end up calling a method (operator()) which has a cycle to call freenect_process_events(m_ctx).

After that... we are able to create the "real" device where a lot of initialization is done.... which doesn't include the startDepth and startVideo calls in FreenectDevice constructor, as the intention is that those are called from the application where the device is being used.

ON THE EXAMPLES
----------------------------

The initialization is done in a different way, basically the cycle that does the calls to freenect_process_events(m_ctx) starts AFTER all the other initialization is done, including the freenect_start_video and freenect_start_depth calls.

MY SOLUTION
---------------------
Just to fix my application I did some tweaks to on the wrapper to make the initialization work as in the examples and that fixed the problem.

What I think is that some synchronization issue is preventing the startDepth/startVideo calls to be executed in a quick way, I can ensure that the delay sometimes occurs on startVideo and sometimes in startDepth, it is not regular but is annoying.

anyway, I think you are doing a great job, hope this report is useful in someway... (I know how this is as I also work on open source projects)