mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +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);
|
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.
|
// Send to the consumer, in left-right order.
|
||||||
xrt_sink_push_frame(q->consumer_left, frames[0]);
|
xrt_sink_push_frame(q->consumer_left, frames[0]);
|
||||||
|
|
Loading…
Reference in a new issue