Jie - 01 January 2011 04:49 PM
Are the functions thread-safe? In particular, can I retrieve colour images and depth images in separates threads without explicit safe guarding against race conditions? Moreover, according to my test, it seems heap corruptions are sometimes triggered by calling StopNUICamera. I am wondering if anyone could confirm my observation…
P.S. I’m using C++ in Visual Studio 2005 (SP1), Windows 7 (64 bit, but I was using the 32 bit compiler).
Many thanks!
!!!!!!!!!!!!!!!!!!!
I confirm the Heap corruption error in the DLL. !!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!
My findings
- Seems a thread stop but effective after a delete. (anybody would guess that)
- The C# example doesn’t looks cluttered by this
My suspicion:
- StartNUICamera start immediately a thread for data acquisition in an internal buffer.
(GetNUICameraColorFrameRGB24 etc … only do thing like memory copy, BTW this could answer your concern)
So that even without call to GetNUICameraXXXXXXX you already had started the time bomb)
- The DLL doesn’t looks like doing that much thread sync.
Debug at assembly level, it crash more violently because “hand unwinding” code is fare more slower than grabbing code and thread concurrency doesn’t execute the same way.
Internal grab buffer could be allocated from grabbing thread (that expect to be executed first because prio raised to TimeCritical, so buffer is not ready before call to GetNUICameraColorFrameRGB24)
- VS 2010 may not suffer of this problem in c++
A hunch based on very few complaints I hear about this issue.
And also because C#/XAML is for people that got latest VS release. VS2005 doesn’t do WPF smoothly.)
Is there a SDK that come with VS2010 that do better on this c++ issue ?
- Not seen more frequently using c++ because Very many developer don’t care doing StopNUICamera.
They just exit from their prototyping codes.
(Except FingertipTuio3d.zip sources, where I see a call to StopNUICamera but I don’t know if it work, the project need VS2010)
- A pb with apartment thread versus separate thread? (I don’t know what is the model used with CLR)
- I resist to the idea to switch to VS2010 (not to mention $)
as it may hide some weakness in the DLL
and may not even work.
Not to mention that I am not ready to switch to C# yet…
I don’t fully understand the purpose of ... int waitTimeout = 2000); in GetNUICameraColorFrameRGB24
I found a C# code
///////////////////
...
CLNUIDevice.GetCameraDepthFrameRGB32(camera, colorImage.ImageData, 500); //normal feed (top)
CLNUIDevice.GetCameraDepthFrameRGB32(camera, depthImage.ImageData, 0); //to be altered feed (bottom)
...
//////////
Why 0 ? What is “bottom” ? related to 0 ?
So I will try the openkinect project to see if what is said about it is true (said to be slower, but looks marginal)
But it’s a heavy boy to compile!
http://openkinect.org/wiki/Getting_Started
This SDK is fare more easy to handle if it works.
Alex ? Any idea on this Heap issue?
Does anybody have a simple sample in c++ to show. (VS 2005 or 2008 welcomed!) ?
Just call Start/StopNUICamera but without crash would be great.