8 std::atomic<uint32_t>* max_size,
9 std::atomic<uint32_t>* event_queue_size,
10 std::atomic<uint32_t>* events_timeout,
11 std::chrono::high_resolution_clock::time_point capture_started)
12 :
frame_archive(selection, max_size, capture_started), key_stream(key_stream),
13 ts_corrector(event_queue_size, events_timeout)
75 std::unique_lock<std::recursive_mutex> lock(
mutex);
77 if(!ready() && !
cv.wait_for(lock,
std::chrono::seconds(5), ready))
throw std::runtime_error(
"Timeout waiting for frames.");
85 std::unique_lock<std::recursive_mutex> lock(
mutex);
96 std::unique_lock<std::recursive_mutex> lock(
mutex);
98 if (!ready() && !
cv.wait_for(lock,
std::chrono::seconds(5), ready))
throw std::runtime_error(
"Timeout waiting for frames.");
109 std::unique_lock<std::recursive_mutex> lock(
mutex);
133 auto timestamp_of_new_frame =
frames[
s].front().additional_data.timestamp;
136 if ((timestamp_of_new_frame > timestamp_of_key_stream) ||
137 (std::fabs(timestamp_of_new_frame - timestamp_of_key_stream) <= std::fabs(timestamp_of_old_frame - timestamp_of_key_stream)))
147 std::unique_lock<std::recursive_mutex> lock(
mutex);
200 bool valid_to_skip =
true;
201 for(
auto s : other_streams)
203 if (std::fabs(t0 -
frames[
s].back().additional_data.timestamp) < std::fabs(
t1 -
frames[
s].back().additional_data.timestamp))
205 valid_to_skip =
false;
209 if(!valid_to_skip)
break;
215 for(
auto s : other_streams)
220 const double t0 =
frames[
s][0].additional_data.timestamp,
t1 =
frames[
s][1].additional_data.timestamp;
234 auto callback_start_time = std::chrono::high_resolution_clock::now();
236 auto ts = std::chrono::duration_cast<std::chrono::milliseconds>(callback_start_time -
capture_started).
count();
246 std::lock_guard<std::recursive_mutex> guard(
mutex);
double get_frame_timestamp(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())
void on_timestamp(rs_timestamp_data data)
frame backbuffer[RS_STREAM_NATIVE_COUNT]
unsigned long long get_frame_number(rs_stream stream) const
double get_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
long long get_frame_system_time(rs_stream stream) const
std::vector< frame > frames[RS_STREAM_NATIVE_COUNT]
frame_metadata
Types of value provided from the device with each frame.
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
void commit_frame(rs_stream stream)
byte * alloc_frame(rs_stream stream, const frame_additional_data &additional_data, bool requires_memory)
int get_frame_stride(rs_stream stream) const
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
void correct_timestamp(frame_interface &frame, rs_stream stream) override
unsigned long long get_frame_number() const override
std::condition_variable_any cv
bool supports_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
bool poll_for_frames_safe(frameset **frames)
GLuint GLuint GLsizei count
int get_frame_bpp(rs_stream stream) const
void place_frame(rs_stream stream, frame &&new_frame)
void update_frame_callback_start_ts(std::chrono::high_resolution_clock::time_point ts)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * data
void discard_frame(rs_stream stream)
frameset * wait_for_frames_safe()
std::recursive_mutex mutex
Timestamp data from the motion microcontroller.
const byte * get_frame_data(rs_stream stream) const
frameset * clone_frameset(frameset *frameset)
std::chrono::high_resolution_clock::time_point capture_started
const char * get_string(rs_stream value)
unsigned long long get_frame_number(rs_stream stream) const
bool supports_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
rs_stream
Streams are different types of data provided by RealSense devices.
long long get_frame_system_time(rs_stream stream) const
void correct_timestamp(rs_stream stream)
int get_frame_bpp(rs_stream stream) const
void dequeue_frame(rs_stream stream)
const byte * get_frame_data(rs_stream stream) const
std::vector< rs_stream > other_streams
rs_frame_metadata
Types of value provided from the device with each frame.
std::vector< frame > freelist
rs_stream get_stream_type() const override
int get_frame_stride(rs_stream stream) const
frameset * clone_frontbuffer()
void on_timestamp(rs_timestamp_data data) override
bool is_stream_enabled(rs_stream stream) const
double get_frame_metadata(rs_stream stream, rs_frame_metadata frame_metadata) const
double get_frame_timestamp(rs_stream stream) const
timestamp_corrector ts_corrector