The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/sink: Make sure gen-locked frames have the same timestamp

+15
+15
src/xrt/auxiliary/util/u_sink_force_genlock.c
··· 122 122 */ 123 123 pthread_mutex_unlock(&q->mutex); 124 124 125 + /* 126 + * Average the timestamps, SLAM systems break if they don't have the exact same timestamp. 127 + * (This is dumb, because on DepthAI the images *are* taken like 0.1ms apart, and we *could* expose 128 + * that, but oh well.) 129 + */ 130 + 131 + int64_t ts_1 = frames[0]->timestamp; 132 + int64_t ts_2 = frames[1]->timestamp; 133 + 134 + int64_t diff = (ts_2 - ts_1); 135 + 136 + int64_t ts = ts_1 + (diff / 2); 137 + 138 + frames[0]->timestamp = ts; 139 + frames[1]->timestamp = ts; 125 140 126 141 // Send to the consumer, in left-right order. 127 142 xrt_sink_push_frame(q->consumer_left, frames[0]);