The open source OpenXR runtime
0
fork

Configure Feed

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

a/math: Update relation history to return something from push.

+9 -4
+4 -1
src/xrt/auxiliary/math/m_relation_history.cpp
··· 62 62 #endif 63 63 } 64 64 65 - void 65 + bool 66 66 m_relation_history_push(struct m_relation_history *rh, struct xrt_space_relation const *in_relation, uint64_t timestamp) 67 67 { 68 68 XRT_TRACE_MARKER(); 69 69 struct relation_history_entry rhe; 70 70 rhe.relation = *in_relation; 71 71 rhe.timestamp = timestamp; 72 + bool ret = false; 72 73 os_mutex_lock(&rh->mutex); 73 74 // Don't evaluate the second condition if the length is 0 - rh->impl[0] will be NULL! 74 75 if ((!rh->has_first_sample) || (rhe.timestamp > rh->impl[0]->timestamp)) { 75 76 // Everything explodes if the timestamps in relation_history aren't monotonically increasing. If we get 76 77 // a timestamp that's before the most recent timestamp in the buffer, just don't put it in the history. 77 78 rh->impl.push(rhe); 79 + ret = true; 78 80 } 79 81 rh->has_first_sample = true; 80 82 os_mutex_unlock(&rh->mutex); 83 + return ret; 81 84 } 82 85 83 86 enum m_relation_history_result
+5 -3
src/xrt/auxiliary/math/m_relation_history.h
··· 49 49 * 50 50 * If the history is full, it will also pop a pose out of the other side of the buffer. 51 51 * 52 + * @return false if the timestamp is earlier than the most recent timestamp already recorded 53 + * 52 54 * @public @memberof m_relation_history 53 55 */ 54 - void 56 + bool 55 57 m_relation_history_push(struct m_relation_history *rh, struct xrt_space_relation const *in_relation, uint64_t ts); 56 58 57 59 /*! ··· 117 119 /*! 118 120 * @copydoc m_relation_history_push 119 121 */ 120 - void 122 + bool 121 123 push(xrt_space_relation const &relation, uint64_t ts) noexcept 122 124 { 123 - m_relation_history_push(mPtr, &relation, ts); 125 + return m_relation_history_push(mPtr, &relation, ts); 124 126 } 125 127 126 128 /*!