5#ifndef LIBREALSENSE_SYNC_H
6#define LIBREALSENSE_SYNC_H
18 fps_calc(
unsigned long long in_number_of_frames_to_sampling,
int expected_fps)
19 : _number_of_frames_to_sample(in_number_of_frames_to_sampling),
21 _actual_fps(expected_fps)
23 _time_samples.reserve(2);
25 double calc_fps(std::chrono::time_point<std::chrono::system_clock>& now_time)
28 if (_frame_counter == _number_of_frames_to_sample || _frame_counter == 1)
30 _time_samples.push_back(now_time);
31 if (_time_samples.size() == 2)
33 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(
34 _time_samples[1] - _time_samples[0]).count();
35 _actual_fps = (((double)_frame_counter - 1.) / duration) * 1000.;
37 _time_samples.clear();
46 unsigned long long _number_of_frames_to_sample;
47 unsigned long long _frame_counter;
48 std::vector<std::chrono::time_point<std::chrono::system_clock>> _time_samples;
57 std::vector<rs_stream> other_streams;
64 std::condition_variable_any cv;
66 void get_next_frames();
75 std::atomic<uint32_t>* max_size,
76 std::atomic<uint32_t>* event_queue_size,
77 std::atomic<uint32_t>* events_timeout,
78 std::chrono::high_resolution_clock::time_point
capture_started = std::chrono::high_resolution_clock::now());
double calc_fps(std::chrono::time_point< std::chrono::system_clock > &now_time)
Definition sync.h:25
fps_calc(unsigned long long in_number_of_frames_to_sampling, int expected_fps)
Definition sync.h:18
std::chrono::high_resolution_clock::time_point capture_started
Definition archive.h:226
void correct_timestamp(rs_stream stream)
double get_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
void on_timestamp(rs_timestamp_data data)
void commit_frame(rs_stream stream)
int get_frame_stride(rs_stream stream) const
long long get_frame_system_time(rs_stream stream) const
frameset * clone_frontbuffer()
unsigned long long get_frame_number(rs_stream stream) const
syncronizing_archive(const std::vector< subdevice_mode_selection > &selection, rs_stream key_stream, std::atomic< uint32_t > *max_size, std::atomic< uint32_t > *event_queue_size, std::atomic< uint32_t > *events_timeout, std::chrono::high_resolution_clock::time_point capture_started=std::chrono::high_resolution_clock::now())
bool supports_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
frameset * wait_for_frames_safe()
const byte * get_frame_data(rs_stream stream) const
bool poll_for_frames_safe(frameset **frames)
double get_frame_timestamp(rs_stream stream) const
int get_frame_bpp(rs_stream stream) const
Definition timestamps.h:49
rs_stream
Streams are different types of data provided by RealSense devices.
Definition rs.h:34
rs_frame_metadata
Types of value provided from the device with each frame.
Definition rs.h:204
Timestamp data from the motion microcontroller.
Definition rs.h:340
const uint8_t RS_STREAM_NATIVE_COUNT
Definition types.h:27