Adjust camera start/stop capture commands to lifetime of RS handle #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Capturing commands were subject to substate mode changes, whereas the lifetime of the RS object instance is tightly bound to the activity thread. This is not a problem in case the component is started in Neutral state and commanded to switch later to PushState as memory has been properly allocated at that time. However, doing so on component init (i.e. with
<initialcomponentmode>parameter equal to PushState) causes the pipeline to attempt an early start. It fails since the thread is not created yet and, consequently,COMP->smart_rs_deviceisNULL. On each loop, fresh frames are requested from the device, but the RS framework complains about the pipeline not being properly started.This commit defers initial pipeline start, decoupling it from state changes. Since
COMP->smart_rs_devicelives for as long asthe thread does its job, pipeline start and stop capture commands are now bound to thread start and stop, respectively. Also,
allocated dynamic memory is now properly destroyed on thread stop.