Send both min and max prediction times
This commit is contained in:
@@ -104,7 +104,8 @@ void wivrn::tracking_control_t::send(wivrn_connection & connection, bool now)
|
||||
return;
|
||||
|
||||
connection.send_stream(to_headset::tracking_control{
|
||||
.offset = std::chrono::nanoseconds(max.exchange(0)),
|
||||
.min_offset = std::chrono::nanoseconds(min.exchange(80'000'000)),
|
||||
.max_offset = std::chrono::nanoseconds(max.exchange(0)),
|
||||
.enabled = enabled,
|
||||
});
|
||||
if (not now)
|
||||
|
||||
@@ -50,6 +50,7 @@ struct wivrn_comp_target_factory;
|
||||
class tracking_control_t
|
||||
{
|
||||
using T = std::chrono::nanoseconds::rep;
|
||||
std::atomic<T> min;
|
||||
std::atomic<T> max;
|
||||
std::chrono::steady_clock::time_point next_sample;
|
||||
std::mutex mutex;
|
||||
@@ -68,6 +69,13 @@ public:
|
||||
while (prev < sample and max.compare_exchange_weak(prev, sample))
|
||||
{
|
||||
}
|
||||
if (sample > 0)
|
||||
{
|
||||
prev = min;
|
||||
while (prev > sample and min.compare_exchange_weak(prev, sample))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
void send(wivrn_connection & connection, bool now = false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user