GetCamera() not working in secondary threads
Posted: Tue Jul 15, 2014 9:50 am
Hi,
I am integrating Camera SDK in a real time OpenGL software that can be extended through "video capture devices" plugins. Those devices are activated, deactivated and updated by the rendering thread, which is different from the program main thread.
The problem is that Camera SDK initialization fails when executed from a thread which is not the main thread.
To characterize the problem I used the following piece of code:
When executed from the program main thread, I get the following result:
The same piece of code executed in another thread gives:
Since in my case I do not have access to the program main thread, I cannot initialize Camera SDK 
I am using Camera SDK 1.5 with 5 Flex-13 USB Cameras connected to one Optihub 2.
I am compiling in 64 bits with VS2010.
Is there any initialization trick that I am missing? Is this a restriction of Camera SDK?
Thanks for your help,
Francis.
I am integrating Camera SDK in a real time OpenGL software that can be extended through "video capture devices" plugins. Those devices are activated, deactivated and updated by the rendering thread, which is different from the program main thread.
The problem is that Camera SDK initialization fails when executed from a thread which is not the main thread.
To characterize the problem I used the following piece of code:
Code: Select all
CameraLibrary_EnableDevelopment();
CameraManager::X().WaitForInitialization();
CameraList cameras;
CameraManager::X().GetCameraList(cameras);
print("Num cameras: " + cameras.Count());
CameraLibrary::Camera* camera = CameraManager::X().GetCamera();
CameraLibrary::Camera* camera2 = CameraManager::X().GetCamera(2);
print("Camera: " + camera + " Camera2: " + camera2);
Code: Select all
Num Cameras: 5
Camera: 182583360 Camera2: 182583360
Code: Select all
Num Cameras: 0
Camera: 0 Camera2: 0

I am using Camera SDK 1.5 with 5 Flex-13 USB Cameras connected to one Optihub 2.
I am compiling in 64 bits with VS2010.
Is there any initialization trick that I am missing? Is this a restriction of Camera SDK?
Thanks for your help,
Francis.