mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
u/sink: Make sure gen-locked frames have the same timestamp
This commit is contained in:
parent
d3c77b435c
commit
bcfd50c839
|
@ -122,6 +122,21 @@ force_genlock_mainloop(void *ptr)
|
|||
*/
|
||||
pthread_mutex_unlock(&q->mutex);
|
||||
|
||||
/*
|
||||
* Average the timestamps, SLAM systems break if they don't have the exact same timestamp.
|
||||
* (This is dumb, because on DepthAI the images *are* taken like 0.1ms apart, and we *could* expose
|
||||
* that, but oh well.)
|
||||
*/
|
||||
|
||||
int64_t ts_1 = frames[0]->timestamp;
|
||||
int64_t ts_2 = frames[1]->timestamp;
|
||||
|
||||
int64_t diff = (ts_2 - ts_1);
|
||||
|
||||
int64_t ts = ts_1 + (diff / 2);
|
||||
|
||||
frames[0]->timestamp = ts;
|
||||
frames[1]->timestamp = ts;
|
||||
|
||||
// Send to the consumer, in left-right order.
|
||||
xrt_sink_push_frame(q->consumer_left, frames[0]);
|
||||
|
|
Loading…
Reference in a new issue