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());
81 void wait_for_frames();
82 bool poll_for_frames();
85 bool poll_for_frames_safe(
frameset ** frames);
90 double get_frame_timestamp(
rs_stream stream)
const;
91 unsigned long long get_frame_number(
rs_stream stream)
const;
92 long long get_frame_system_time(
rs_stream stream)
const;
93 int get_frame_stride(
rs_stream stream)
const;
94 int get_frame_bpp(
rs_stream stream)
const;
101 void flush()
override;
103 void correct_timestamp(
rs_stream stream);
frame_metadata
Definition: rs.hpp:155
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
double calc_fps(std::chrono::time_point< std::chrono::system_clock > &now_time)
Definition: sync.h:25
uint8_t byte
Definition: types.h:42
rs_stream
Definition: rs.h:27
rs_frame_metadata
Definition: rs.h:195
Definition: archive.h:185