File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 99#include " media/ros/ros_writer.h"
1010#include < src/proc/syncer-processing-block.h>
1111#include < src/core/frame-callback.h>
12+ #include < src/dds/rs-dds-device-proxy.h>
1213
1314#include < rsutils/string/from.h>
1415
@@ -127,8 +128,19 @@ namespace librealsense
127128 }
128129
129130 _dispatcher.start ();
130- profile->_multistream .open ();
131- profile->_multistream .start (callbacks);
131+ if ( Is< librealsense::dds_device_proxy >( dev ) )
132+ {
133+ // For DDS devices open() only sets requested profiles, start() actually starts streaming.
134+ // Calling open() then start() sends open-streams control for all sensors before starting to stream,
135+ // second open-streams control will resets the first (reverting first requested streams to defaults).
136+ // open_and_start() starts streaming from the first sensor before the second open so it does not reset.
137+ profile->_multistream .open_and_start ( callbacks );
138+ }
139+ else
140+ {
141+ profile->_multistream .open ();
142+ profile->_multistream .start ( callbacks );
143+ }
132144 _active_profile = profile;
133145 _prev_conf = std::make_shared<config>(*conf);
134146 }
Original file line number Diff line number Diff line change @@ -157,6 +157,19 @@ namespace librealsense
157157 sensor.second ->start (callback);
158158 }
159159
160+ template < class T >
161+ void open_and_start ( T callback )
162+ {
163+ // Calling open() than start() opens all relevant sensors before starting any of them.
164+ // For some device backends we want to open and start each sensor before opening the next sensor.
165+ for ( auto it = _dev_to_profiles.rbegin (); it != _dev_to_profiles.rend (); it++ )
166+ {
167+ auto && sub = _results.at ( it->first );
168+ sub->open ( it->second );
169+ sub->start ( callback );
170+ }
171+ }
172+
160173 void stop ()
161174 {
162175 for (auto && sensor : _results)
You can’t perform that action at this time.
0 commit comments