-
Notifications
You must be signed in to change notification settings - Fork 4.9k
optimize RS-Viewer loading time #13985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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? |
src/core/device-interface.h
Outdated
@@ -70,6 +70,8 @@ class device_interface | |||
|
|||
virtual bool contradicts( const stream_profile_interface * a, | |||
const std::vector< stream_profile > & others ) const = 0; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OhadMeir any idea how this added an API w/o adding it to the include headers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copies the object. Can use auto &
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/core/device-interface.h
Outdated
@@ -70,6 +70,8 @@ class device_interface | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming initialize
. Adding controls is specific initialization for a device type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -19,6 +19,7 @@ | |||
#include <mutex> | |||
#include <set> | |||
#include <regex> | |||
#include <api.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed that
src/platform-camera.cpp
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
… 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)