optimize RS-Viewer loading time - #13985
Conversation
…alsense logo on startup. as the try-catch mechanism is very time consuming, and as platform camera is in high probability w/o these controls, we want to try and add them in parallel to the viewer execution and avoid adding them from the main thread (which will stuck the logo for several seconds)
|
Can one of the admins verify this patch? |
|
|
||
| virtual bool contradicts( const stream_profile_interface * a, | ||
| const std::vector< stream_profile > & others ) const = 0; | ||
|
|
There was a problem hiding this comment.
@OhadMeir any idea how this added an API w/o adding it to the include headers?
There was a problem hiding this comment.
realsense-viewer.cpp added an include to api.h which, despite the name, is actually under src folder. This bypass the API mechanism.
| auto dev_itr = begin(future_initialization_devices); | ||
| while (dev_itr != end(future_initialization_devices)) | ||
| { | ||
| auto dev = *dev_itr; |
There was a problem hiding this comment.
Copies the object. Can use auto &?
| virtual bool contradicts( const stream_profile_interface * a, | ||
| const std::vector< stream_profile > & others ) const = 0; | ||
|
|
||
| virtual void add_controls() = 0; |
There was a problem hiding this comment.
Consider renaming initialize. Adding controls is specific initialization for a device type.
| #include <mutex> | ||
| #include <set> | ||
| #include <regex> | ||
| #include <api.h> |
There was a problem hiding this comment.
Files under src folder should not be included by user application, only from include folder.
If a function needs to be exposed to users it should be done via the C API.
I am still not sure we need a new API for this.
| color_ep->try_register_pu( RS2_OPTION_WHITE_BALANCE ); | ||
| color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_EXPOSURE ); | ||
| color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE ); | ||
| void platform_camera::initialize() |
There was a problem hiding this comment.
Currently initialize is added to device-interface but is relevant only here. Can we just open a thread in platform-device constructor that will do the initialization (maybe even after some sleep time)?
| if (allow_future_initialization) | ||
| { | ||
| auto dev_itr = begin(future_initialization_devices); | ||
| while (dev_itr != end(future_initialization_devices)) |
There was a problem hiding this comment.
Style only - I would discard the flag and use the vector as indication if a job is needed.
while( ! future_initialization_devices.empty() )
{
//Handle a device
//Erase that device from the list
}
… init on a separate thread with 2 sec delay

allow late initialization for platform camera in order not to hold realsense logo on startup.
tracked by LRS-1254
as the try-catch mechanism is very time consuming, and as platform camera is in high probability w/o these controls, we want to try and add them in parallel to the viewer execution and avoid adding them from the main thread (which will stuck the logo for several seconds)