Closed tim-depthkit closed 3 years ago
Yep, that make sense. Do you think this can be covered as a CMake parameter or dedicated API?
A CMake option would be sufficient for my use case.
On Wed, Jun 19, 2019 at 7:50 AM Sergey Dorodnicov notifications@github.com wrote:
Yep, that make sense. Do you think this can be covered as a CMake parameter or dedicated API?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IntelRealSense/librealsense/issues/4238?email_source=notifications&email_token=AGDHJGYORQYCS5HMQYDL3T3P3IMQFA5CNFSM4HZDXXD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYBTRFA#issuecomment-503527572, or mute the thread https://github.com/notifications/unsubscribe-auth/AGDHJG7SHWR47BE6E7USWD3P3IMQFANCNFSM4HZDXXDQ .
-- Timothy Scaffidi Head of Engineering Scatter | https://scatter.nyc
We are planning on implementing this. The rough schedule is Q3. Thanks.
The change has been merged into the development branch. Please let us know if there is any concerns. Thank you.
This enhancement is included in the v2.40.0 release. Thank you. Release Notes and search for DSO-15197 Closing this case.
Hi @tim-depthkit, @dorodnic,
I encounter issues using the Qt framework after initializing my Intel camera D415 so reading these posts is really helpful to understand the root cause.
My issue (Main-UI blocked when opening a QFileDialog) seems to be solved by using librealsense compiled with the cmake option COM_MULTITHREADED set to OFF.
Could you please give me more insights regarding the impact this option can have on the SDK behaviour ? The doc mentions that "stop sensor can take several seconds". @tim-depthkit Have you noticed unwanted side effects with the option COM_MULTITHREADED set to OFF ? @RealSenseCustomerSupport to what extent do you recommend to preferably use the SDK with this option set to ON ?
Thanks for your support!
Hi @kayychou The only available RealSense related reference to COM_MULTITHREADED is a line in the lrs_options CMake file that provides for COM_MULTITHREADED the description "Set OFF to initialize COM library with COINIT_APARTMENTTHREADED". It is set to On by default.
https://github.com/IntelRealSense/librealsense/blob/master/CMake/lrs_options.cmake#L8C27-L8C90
A Microsoft reference at the link below suggests that COINT_APARTMENTTHREADED should be used (i.e set to On) when there is a thread that creates a window. So you could interpret that to mean that when COM_MULTITHREADED is set to Off, COINT_APARTMENTTHREADED is On, which is useful in a thread that needs to create a window.
https://learn.microsoft.com/en-us/windows/win32/learnwin32/initializing-the-com-library
Issue Description
Currently the WMF backend initialized COM as follows:
CoInitializeEx(nullptr, COINIT_MULTITHREADED); // when using COINIT_APARTMENTTHREADED, calling _pISensor->SetEventSink(NULL) to stop sensor can take several seconds
However in applications that have COM initializations on other threads using COINIT_APARTMENTTHREADED (like the Qt framework, for example), this can lead to a deadlock inside COM functions.
As the comment suggests, there is a reason for initializing in this way, but the SDK user should be allowed to configure this if necessary, via a CMake build option or similar.