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());
101 void flush()
override;
long long get_frame_system_time(rs_stream stream) const
double get_frame_timestamp(rs_stream stream) const
frame_metadata
Definition: rs.hpp:155
int get_frame_stride(rs_stream stream) const
frameset * wait_for_frames_safe()
void on_timestamp(rs_timestamp_data data)
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())
const uint8_t RS_STREAM_NATIVE_COUNT
Definition: types.h:27
stream
Definition: rs.hpp:20
fps_calc(unsigned long long in_number_of_frames_to_sampling, int expected_fps)
Definition: sync.h:18
Definition: timestamps.h:49
frameset * clone_frontbuffer()
const byte * get_frame_data(rs_stream stream) const
double calc_fps(std::chrono::time_point< std::chrono::system_clock > &now_time)
Definition: sync.h:25
void correct_timestamp(rs_stream stream)
std::chrono::high_resolution_clock::time_point capture_started
Definition: archive.h:226
bool supports_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
rs_stream
Definition: rs.h:27
bool poll_for_frames_safe(frameset **frames)
rs_frame_metadata
Definition: rs.h:195
double get_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
int get_frame_bpp(rs_stream stream) const
void commit_frame(rs_stream stream)
Definition: archive.h:185
unsigned long long get_frame_number(rs_stream stream) const