33 std::lock_guard<std::mutex>
lock(
_mtx);
45 std::lock_guard<std::mutex>
lock(
_mtx);
59 std::shared_ptr<profile>
profile =
nullptr;
61 auto cached_profile = conf->get_cached_resolved_profile();
64 profile = cached_profile;
68 const int NUM_TIMES_TO_RETRY = 3;
69 for (
int i = 1;
i <= NUM_TIMES_TO_RETRY;
i++)
73 profile = conf->resolve(shared_from_this(), std::chrono::seconds(5));
78 if (
i == NUM_TIMES_TO_RETRY)
85 if (!profile->_multistream.get_profiles().size())
88 auto synced_streams_ids =
on_start(profile);
92 auto dev = profile->get_device();
93 if (
auto playback = As<librealsense::playback_device>(
dev))
114 profile->_multistream.open();
115 profile->_multistream.start(callbacks);
122 std::lock_guard<std::mutex>
lock(
_mtx);
139 if (
auto playback = As<librealsense::playback_device>(
dev))
172 std::vector<int> _streams_to_aggregate_ids;
173 std::vector<int> _streams_to_sync_ids;
174 bool sync_any =
false;
178 for (
auto&&
s : profile->get_active_streams())
180 _streams_to_aggregate_ids.push_back(
s->get_unique_id());
181 bool sync_current = sync_any;
185 _streams_to_sync_ids.push_back(
s->get_unique_id());
189 _aggregator = std::unique_ptr<aggregator>(
new aggregator(_streams_to_aggregate_ids, _streams_to_sync_ids));
194 return _streams_to_sync_ids;
209 _syncer->set_output_callback(to_pipeline_process);
211 auto to_syncer = [&, synced_streams_ids](
frame_holder fref)
214 if (
std::find(synced_streams_ids.begin(), synced_streams_ids.end(), fref->get_stream()->get_unique_id()) != synced_streams_ids.end())
230 std::lock_guard<std::mutex>
lock(
_mtx);
261 catch (
const std::exception&
e)
263 throw std::runtime_error(
to_string() <<
"Device disconnected. Failed to recconect: " << e.what() << timeout_ms);
266 throw std::runtime_error(
to_string() <<
"Frame didn't arrive within " << timeout_ms);
271 std::lock_guard<std::mutex>
lock(
_mtx);
291 std::lock_guard<std::mutex>
lock(
_mtx);
316 catch (
const std::exception&
e)
static const textual_icon lock
bool is_connected(const device_interface &dev)
std::unique_ptr< aggregator > _aggregator
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
bool poll_for_frames(frame_holder *frame)
frame_holder wait_for_frames(unsigned int timeout_ms)
GLsizei const GLchar *const * string
std::vector< rs2_stream > _synced_streams
status
Defines return codes that SDK interfaces use. Negative values indicate errors, a zero value indicates...
bool try_wait_for_frames(frame_holder *frame, unsigned int timeout_ms)
std::unique_ptr< syncer_process_unit > _syncer
void unsafe_start(std::shared_ptr< config > conf)
std::vector< int > on_start(std::shared_ptr< profile > profile)
std::shared_ptr< profile > start(std::shared_ptr< config > conf, frame_callback_ptr callback=nullptr)
frame_callback_ptr get_callback(std::vector< int > unique_ids)
std::shared_ptr< device_interface > wait_for_device(const std::chrono::milliseconds &timeout=std::chrono::milliseconds(std::chrono::hours(1)), bool loop_through_devices=true, const std::string &serial="")
#define RS2_PRODUCT_LINE_ANY_INTEL
frame_callback_ptr _streams_callback
LOG_INFO("Log message using LOG_INFO()")
std::shared_ptr< profile > _active_profile
std::shared_ptr< config > _prev_conf
GLbitfield GLuint64 timeout
std::shared_ptr< profile > unsafe_get_active_profile() const
std::shared_ptr< librealsense::context > get_context() const
void invoke(T item, bool is_blocking=false)
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
int _playback_stopped_token
std::shared_ptr< device_interface > wait_for_device(const std::chrono::milliseconds &timeout=std::chrono::hours::max(), const std::string &serial="")
std::shared_ptr< profile > get_active_profile() const
std::shared_ptr< librealsense::context > _ctx
std::string to_string(T value)