Skip to content

Commit 9f8861a

Browse files
authored
PR #13449 from OhadMeir: DDS pipeline streams from sensor before opening another
2 parents 97d1b83 + e8fa647 commit 9f8861a

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/pipeline/pipeline.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#include "media/ros/ros_writer.h"
1010
#include <src/proc/syncer-processing-block.h>
1111
#include <src/core/frame-callback.h>
12+
#ifdef BUILD_WITH_DDS
13+
#include <src/dds/rs-dds-device-proxy.h>
14+
#endif
1215

1316
#include <rsutils/string/from.h>
1417

@@ -127,8 +130,21 @@ namespace librealsense
127130
}
128131

129132
_dispatcher.start();
130-
profile->_multistream.open();
131-
profile->_multistream.start(callbacks);
133+
#ifdef BUILD_WITH_DDS
134+
if( Is< librealsense::dds_device_proxy >( dev ) )
135+
{
136+
// For DDS devices open() only sets requested profiles, start() actually starts streaming.
137+
// Calling open() then start() sends open-streams control for all sensors before starting to stream,
138+
// second open-streams control will resets the first (reverting first requested streams to defaults).
139+
// open_and_start() starts streaming from the first sensor before the second open so it does not reset.
140+
profile->_multistream.open_and_start( callbacks );
141+
}
142+
else
143+
#endif
144+
{
145+
profile->_multistream.open();
146+
profile->_multistream.start( callbacks );
147+
}
132148
_active_profile = profile;
133149
_prev_conf = std::make_shared<config>(*conf);
134150
}

src/pipeline/resolver.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)