Rework wivrn_session to be a xrt_system_devices

This will allow changing roles dynamically, and fixes some object
lifetime issues.
This commit is contained in:
Patrick Nicolas
2024-10-08 20:10:39 +02:00
parent fb66a99f14
commit 849eeb7a80
8 changed files with 163 additions and 135 deletions
+15 -15
View File
@@ -113,7 +113,7 @@ static void create_encoders(wivrn_comp_target * cn)
auto & desc = cn->desc;
desc.width = cn->width;
desc.height = cn->height;
desc.foveation = cn->cnx->set_foveated_size(desc.width, desc.height);
desc.foveation = cn->cnx.set_foveated_size(desc.width, desc.height);
std::map<int, std::vector<std::shared_ptr<VideoEncoder>>> thread_params;
@@ -135,7 +135,7 @@ static void create_encoders(wivrn_comp_target * cn)
pthread_setname_np(thread.native_handle(), name.c_str());
}
cn->pacer.set_stream_count(cn->encoders.size());
cn->cnx->send_control(desc);
cn->cnx.send_control(desc);
}
static VkResult create_images(struct wivrn_comp_target * cn, vk::ImageUsageFlags flags)
@@ -265,7 +265,7 @@ static bool comp_wivrn_init_post_vulkan(struct comp_target * ct, uint32_t prefer
*cn->wivrn_bundle,
cn->c->settings.preferred.width,
cn->c->settings.preferred.height,
cn->cnx->get_info());
cn->cnx.get_info());
print_encoders(cn->settings);
}
catch (const std::exception & e)
@@ -274,7 +274,7 @@ static bool comp_wivrn_init_post_vulkan(struct comp_target * ct, uint32_t prefer
return false;
}
if (cn->cnx->has_dynamic_foveation())
if (cn->cnx.has_dynamic_foveation())
{
cn->foveation_renderer = std::make_unique<wivrn_foveation_renderer>(*cn->wivrn_bundle, cn->command_pool);
}
@@ -285,7 +285,7 @@ static bool comp_wivrn_init_post_vulkan(struct comp_target * ct, uint32_t prefer
static bool comp_wivrn_check_ready(struct comp_target * ct)
{
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
if (not cn->cnx->connected())
if (not cn->cnx.connected())
return false;
// This function is called before on each frame before reprojection
@@ -444,7 +444,7 @@ static void comp_wivrn_present_thread(std::stop_token stop_token, wivrn_comp_tar
{
for (auto & encoder: encoders)
{
encoder->Encode(*cn->cnx, view_info, frame_index);
encoder->Encode(cn->cnx, view_info, frame_index);
}
}
catch (std::exception & e)
@@ -481,7 +481,7 @@ static VkResult comp_wivrn_present(struct comp_target * ct,
.pWaitDstStageMask = &wait_stage,
};
if (cn->c->base.layer_accum.layer_count == 0 or not cn->cnx->get_offset())
if (cn->c->base.layer_accum.layer_count == 0 or not cn->cnx.get_offset())
{
scoped_lock lock(vk->queue_mutex);
cn->wivrn_bundle->queue.submit(submit_info);
@@ -518,9 +518,9 @@ static VkResult comp_wivrn_present(struct comp_target * ct,
#endif
auto & view_info = cn->psc.view_info;
view_info.foveation = cn->cnx->get_foveation_parameters();
view_info.foveation = cn->cnx.get_foveation_parameters();
auto info = cn->pacer.present_to_info(desired_present_time_ns);
view_info.display_time = cn->cnx->get_offset().to_headset(info.predicted_display_time);
view_info.display_time = cn->cnx.get_offset().to_headset(info.predicted_display_time);
for (int eye = 0; eye < 2; ++eye)
{
const auto & frame_params = cn->c->base.frame_params;
@@ -558,7 +558,7 @@ static void comp_wivrn_flush(struct comp_target * ct)
#endif
// apply foveation for current frame
if (cn->cnx->apply_dynamic_foveation())
if (cn->cnx.apply_dynamic_foveation())
// foveation renderer already signaled the semaphore; nothing to do
return;
@@ -606,15 +606,15 @@ static void comp_wivrn_mark_timing_point(struct comp_target * ct,
switch (point)
{
case COMP_TARGET_TIMING_POINT_WAKE_UP:
cn->cnx->dump_time("wake_up", frame_id, when_ns);
cn->cnx.dump_time("wake_up", frame_id, when_ns);
break;
case COMP_TARGET_TIMING_POINT_BEGIN:
cn->cnx->dump_time("begin", frame_id, when_ns);
cn->cnx.dump_time("begin", frame_id, when_ns);
break;
case COMP_TARGET_TIMING_POINT_SUBMIT_BEGIN:
break;
case COMP_TARGET_TIMING_POINT_SUBMIT_END:
cn->cnx->dump_time("submit", frame_id, when_ns);
cn->cnx.dump_time("submit", frame_id, when_ns);
break;
default:
assert(false);
@@ -667,7 +667,7 @@ void wivrn_comp_target::reset_encoders()
{
encoder->SyncNeeded();
}
cnx->send_control(desc);
cnx.send_control(desc);
}
void wivrn_comp_target::render_dynamic_foveation(std::array<to_headset::foveation_parameter, 2> foveation)
@@ -691,7 +691,7 @@ void wivrn_comp_target::render_dynamic_foveation(std::array<to_headset::foveatio
}
}
wivrn_comp_target::wivrn_comp_target(std::shared_ptr<wivrn::wivrn_session> cnx, struct comp_compositor * c, float fps) :
wivrn_comp_target::wivrn_comp_target(wivrn::wivrn_session & cnx, struct comp_compositor * c, float fps) :
comp_target{},
pacer(U_TIME_1S_IN_NS / fps),
cnx(cnx)
+2 -2
View File
@@ -98,10 +98,10 @@ struct wivrn_comp_target : public comp_target
std::list<std::jthread> encoder_threads;
std::vector<std::shared_ptr<VideoEncoder>> encoders;
std::shared_ptr<wivrn::wivrn_session> cnx;
wivrn::wivrn_session & cnx;
std::unique_ptr<wivrn_foveation_renderer> foveation_renderer = nullptr;
wivrn_comp_target(std::shared_ptr<wivrn::wivrn_session> cnx, struct comp_compositor * c, float fps);
wivrn_comp_target(wivrn::wivrn_session & cnx, struct comp_compositor * c, float fps);
~wivrn_comp_target();
void on_feedback(const from_headset::feedback &, const clock_offset &);
+2 -4
View File
@@ -43,9 +43,8 @@ static void wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev,
int64_t at_timestamp_ns,
xrt_space_relation * out_relation);
wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd,
std::shared_ptr<wivrn::wivrn_session> cnx) :
xrt_device{}, gaze(device_id::EYE_GAZE), cnx(cnx)
wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd) :
xrt_device{}, gaze(device_id::EYE_GAZE)
{
xrt_device * base = this;
base->tracking_origin = hmd->tracking_origin;
@@ -99,7 +98,6 @@ void wivrn_eye_tracker::update_tracking(const from_headset::tracking & tracking,
static void wivrn_eye_tracker_destroy(xrt_device * xdev)
{
static_cast<wivrn_eye_tracker *>(xdev)->unregister();
}
static void wivrn_eye_tracker_update_inputs(xrt_device * xdev)
+1 -10
View File
@@ -26,28 +26,19 @@
#include "xrt/xrt_device.h"
#include <cstdint>
#include <memory>
#include <mutex>
namespace wivrn
{
class wivrn_session;
class wivrn_eye_tracker : public xrt_device
{
std::mutex mutex;
xrt_input gaze_input;
pose_list gaze;
std::shared_ptr<wivrn::wivrn_session> cnx;
public:
wivrn_eye_tracker(xrt_device * hmd, std::shared_ptr<wivrn::wivrn_session> cnx);
void unregister()
{
cnx = nullptr;
}
wivrn_eye_tracker(xrt_device * hmd);
void update_inputs();
void update_tracking(const from_headset::tracking &, const clock_offset &);
+3 -4
View File
@@ -46,7 +46,7 @@ static xrt_result_t wivrn_fb_face2_tracker_get_face_tracking(struct xrt_device *
struct xrt_facial_expression_set * out_value);
wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd,
std::shared_ptr<wivrn::wivrn_session> cnx) :
wivrn::wivrn_session & cnx) :
xrt_device{}, cnx(cnx)
{
xrt_device * base = this;
@@ -88,14 +88,14 @@ void wivrn_fb_face2_tracker::update_tracking(const from_headset::tracking & trac
};
if (not face_list.update_tracking(tracking.production_timestamp, tracking.timestamp, data, offset))
cnx->set_enabled(to_headset::tracking_control::id::face, false);
cnx.set_enabled(to_headset::tracking_control::id::face, false);
}
xrt_result_t wivrn_fb_face2_tracker::get_face_tracking(enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set * inout_value)
{
if (facial_expression_type == XRT_INPUT_FB_FACE_TRACKING2_VISUAL)
{
cnx->set_enabled(to_headset::tracking_control::id::face, true);
cnx.set_enabled(to_headset::tracking_control::id::face, true);
auto [_, data] = face_list.get_at(at_timestamp_ns);
inout_value->face_expression_set2_fb.is_valid = data.is_valid;
@@ -124,7 +124,6 @@ xrt_result_t wivrn_fb_face2_tracker::get_face_tracking(enum xrt_input_name facia
static void wivrn_fb_face2_tracker_destroy(xrt_device * xdev)
{
static_cast<wivrn_fb_face2_tracker *>(xdev)->unregister();
}
static void wivrn_fb_face2_tracker_update_inputs(xrt_device * xdev)
+2 -7
View File
@@ -28,7 +28,6 @@
#include <array>
#include <cmath>
#include <memory>
#include <openxr/openxr.h>
namespace wivrn
@@ -90,14 +89,10 @@ class wivrn_fb_face2_tracker : public xrt_device
fb_face2_list face_list;
xrt_input face_input;
std::shared_ptr<wivrn::wivrn_session> cnx;
wivrn::wivrn_session & cnx;
public:
wivrn_fb_face2_tracker(xrt_device * hmd, std::shared_ptr<wivrn::wivrn_session> cnx);
void unregister()
{
cnx = nullptr;
}
wivrn_fb_face2_tracker(xrt_device * hmd, wivrn::wivrn_session & cnx);
void update_inputs();
void update_tracking(const from_headset::tracking &, const clock_offset &);
+120 -88
View File
@@ -28,7 +28,6 @@
#include "util/u_builders.h"
#include "util/u_logging.h"
#include "util/u_system.h"
#include "util/u_system_helpers.h"
#include "utils/scoped_lock.h"
#include "audio/audio_setup.h"
@@ -58,10 +57,10 @@ namespace wivrn
struct wivrn_comp_target_factory : public comp_target_factory
{
std::shared_ptr<wivrn_session> session;
wivrn_session & session;
float fps;
wivrn_comp_target_factory(std::shared_ptr<wivrn_session> session, float fps) :
wivrn_comp_target_factory(wivrn_session & session, float fps) :
comp_target_factory{
.name = "WiVRn",
.identifier = "wivrn",
@@ -87,8 +86,8 @@ struct wivrn_comp_target_factory : public comp_target_factory
static bool create_target(const struct comp_target_factory * ctf, struct comp_compositor * c, struct comp_target ** out_ct)
{
auto self = (wivrn_comp_target_factory *)ctf;
self->session->comp_target = new wivrn_comp_target(self->session, c, self->fps);
*out_ct = self->session->comp_target;
self->session.comp_target = new wivrn_comp_target(self->session, c, self->fps);
*out_ct = self->session.comp_target;
return true;
}
};
@@ -114,6 +113,12 @@ void wivrn::tracking_control_t::set_enabled(to_headset::tracking_control::id id,
}
wivrn::wivrn_session::wivrn_session(wivrn::TCP && tcp, u_system & system) :
xrt_system_devices{
.get_roles = [](xrt_system_devices * self, xrt_system_roles * out_roles) { return ((wivrn_session *)self)->get_roles(out_roles); },
.feature_inc = [](xrt_system_devices * self, xrt_device_feature_type f) { return ((wivrn_session *)self)->feature_inc(f); },
.feature_dec = [](xrt_system_devices * self, xrt_device_feature_type f) { return ((wivrn_session *)self)->feature_dec(f); },
.destroy = [](xrt_system_devices * self) { delete ((wivrn_session *)self); },
},
connection(std::move(tcp)),
info([](wivrn_connection & connection) {
std::optional<wivrn::from_headset::packets> control;
@@ -128,62 +133,34 @@ wivrn::wivrn_session::wivrn_session(wivrn::TCP && tcp, u_system & system) :
left_hand(0, &hmd, this),
right_hand(1, &hmd, this)
{
}
xrt_result_t wivrn::wivrn_session::create_session(wivrn::TCP && tcp,
u_system & system,
xrt_system_devices ** out_xsysd,
xrt_space_overseer ** out_xspovrs,
xrt_system_compositor ** out_xsysc)
{
std::shared_ptr<wivrn_session> self;
try
{
self = std::shared_ptr<wivrn_session>(new wivrn_session(std::move(tcp), system));
}
catch (std::exception & e)
{
U_LOG_E("Error creating WiVRn session: %s", e.what());
return XRT_ERROR_DEVICE_CREATION_FAILED;
}
send_to_main(self->info);
try
{
self->audio_handle = audio_device::create(
audio_handle = audio_device::create(
"wivrn.source",
"WiVRn(microphone)",
"wivrn.sink",
"WiVRn",
self->info,
*self);
if (self->audio_handle)
self->send_control(self->audio_handle->description());
info,
*this);
if (audio_handle)
send_control(audio_handle->description());
}
catch (const std::exception & e)
{
U_LOG_E("Failed to register audio device: %s", e.what());
return XRT_ERROR_DEVICE_CREATION_FAILED;
throw;
}
auto * usysds = u_system_devices_static_allocate();
*out_xsysd = &usysds->base.base;
auto & devices = *out_xsysd;
int n = 0;
static_roles.head = xdevs[xdev_count++] = &hmd;
usysds->base.base.static_roles.head = devices->xdevs[n++] = &self->hmd;
if (hmd.face_tracking_supported)
static_roles.face = &hmd;
if (self->hmd.face_tracking_supported)
usysds->base.base.static_roles.face = &self->hmd;
roles.left = xdev_count;
static_roles.hand_tracking.left = xdevs[xdev_count++] = &left_hand;
devices->xdevs[n++] = &self->left_hand;
xrt_device * active_left_hand = &self->left_hand;
usysds->base.base.static_roles.hand_tracking.left = &self->left_hand;
devices->xdevs[n++] = &self->right_hand;
xrt_device * active_right_hand = &self->right_hand;
usysds->base.base.static_roles.hand_tracking.right = &self->right_hand;
roles.right = xdev_count;
static_roles.hand_tracking.right = xdevs[xdev_count++] = &right_hand;
#if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE
auto use_steamvr_lh = std::getenv("WIVRN_USE_STEAMVR_LH");
@@ -194,55 +171,78 @@ xrt_result_t wivrn::wivrn_session::create_session(wivrn::TCP && tcp,
for (int i = 0; i < lhdevs->xdev_count; i++)
{
auto lhdev = lhdevs->xdevs[i];
devices->xdevs[n++] = lhdev;
switch (lhdev->device_type)
{
case XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER:
active_left_hand = lhdev;
usysds->base.base.static_roles.hand_tracking.left = lhdev;
roles.left = xdev_count;
static_roles.hand_tracking.left = lhdev;
break;
case XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER:
active_right_hand = lhdev;
usysds->base.base.static_roles.hand_tracking.right = lhdev;
roles.right = xdev_count;
static_roles.hand_tracking.right = lhdev;
break;
default:
break;
}
xdevs[xdev_count++] = lhdev;
}
}
#endif
if (self->info.eye_gaze)
if (info.eye_gaze)
{
self->eye_tracker = std::make_unique<wivrn_eye_tracker>(&self->hmd, self);
self->foveation = std::make_unique<wivrn_foveation>();
usysds->base.base.static_roles.eyes = self->eye_tracker.get();
devices->xdevs[n++] = self->eye_tracker.get();
eye_tracker = std::make_unique<wivrn_eye_tracker>(&hmd);
foveation = std::make_unique<wivrn_foveation>();
static_roles.eyes = eye_tracker.get();
xdevs[xdev_count++] = eye_tracker.get();
}
if (self->info.face_tracking2_fb)
if (info.face_tracking2_fb)
{
self->fb_face2_tracker = std::make_unique<wivrn_fb_face2_tracker>(&self->hmd, self);
usysds->base.base.static_roles.face = self->fb_face2_tracker.get();
devices->xdevs[n++] = self->fb_face2_tracker.get();
fb_face2_tracker = std::make_unique<wivrn_fb_face2_tracker>(&hmd, *this);
static_roles.face = fb_face2_tracker.get();
xdevs[xdev_count++] = fb_face2_tracker.get();
}
#if WIVRN_FEATURE_SOLARXR
xrt_device * solar_devs[XRT_SYSTEM_MAX_DEVICES];
uint32_t solar_devs_cap = XRT_SYSTEM_MAX_DEVICES - devices->xdev_count;
uint32_t num_devs = solarxr_device_create_xdevs(&self->hmd, solar_devs, XRT_SYSTEM_MAX_DEVICES - devices->xdev_count);
uint32_t solar_devs_cap = XRT_SYSTEM_MAX_DEVICES - xdev_count;
uint32_t num_devs = solarxr_device_create_xdevs(&hmd, solar_devs, XRT_SYSTEM_MAX_DEVICES - xdev_count);
for (int i = 0; i < num_devs; i++)
{
devices->xdevs[n++] = solar_devs[i];
xdevs[xdev_count++] = solar_devs[i];
if (i == 0)
usysds->base.base.static_roles.body = solar_devs[i];
static_roles.body = solar_devs[i];
}
#endif
devices->xdev_count = n;
if (roles.left >= 0)
roles.left_profile = xdevs[roles.left]->name;
if (roles.right >= 0)
roles.right_profile = xdevs[roles.right]->name;
if (roles.gamepad >= 0)
roles.gamepad_profile = xdevs[roles.gamepad]->name;
}
u_system_devices_static_finalize(usysds, active_left_hand, active_right_hand);
xrt_result_t wivrn::wivrn_session::create_session(wivrn::TCP && tcp,
u_system & system,
xrt_system_devices ** out_xsysd,
xrt_space_overseer ** out_xspovrs,
xrt_system_compositor ** out_xsysc)
{
std::unique_ptr<wivrn_session> self;
try
{
self.reset(new wivrn_session(std::move(tcp), system));
}
catch (std::exception & e)
{
U_LOG_E("Error creating WiVRn session: %s", e.what());
return XRT_ERROR_DEVICE_CREATION_FAILED;
}
wivrn_comp_target_factory ctf(self, self->info.preferred_refresh_rate);
send_to_main(self->info);
wivrn_comp_target_factory ctf(*self, self->info.preferred_refresh_rate);
auto xret = comp_main_create_system_compositor(&self->hmd, &ctf, out_xsysc);
if (xret != XRT_SUCCESS)
{
@@ -255,23 +255,20 @@ xrt_result_t wivrn::wivrn_session::create_session(wivrn::TCP && tcp,
&self->hmd,
&self->left_hand,
&self->right_hand,
devices->xdevs,
devices->xdev_count,
self->xdevs,
self->xdev_count,
false,
out_xspovrs);
self->space_overseer = *out_xspovrs;
devices->destroy = [](xrt_system_devices * xsd) {
// TODO
};
auto dump_file = std::getenv("WIVRN_DUMP_TIMINGS");
if (dump_file)
{
self->feedback_csv.open(dump_file);
}
self->thread = std::thread(&wivrn_session::run, self);
self->thread = std::jthread(&wivrn_session::run, self.get());
*out_xsysd = self.release();
return XRT_SUCCESS;
}
@@ -430,28 +427,20 @@ void wivrn_session::operator()(to_monado::disconnect &&)
throw std::runtime_error("Disconnecting as requested by main loop");
}
void wivrn_session::run(std::weak_ptr<wivrn_session> weak_self)
void wivrn_session::run(std::stop_token stop)
{
while (true)
while (not stop.stop_requested())
{
try
{
auto self = weak_self.lock();
if (self and not self->quit)
{
self->offset_est.request_sample(self->connection);
self->tracking_control.send(self->connection);
self->connection.poll(*self, 20);
}
else
return;
offset_est.request_sample(connection);
tracking_control.send(connection);
connection.poll(*this, 20);
}
catch (const std::exception & e)
{
U_LOG_E("Exception in network thread: %s", e.what());
auto self = weak_self.lock();
if (self)
self->reconnect();
reconnect();
}
}
}
@@ -552,4 +541,47 @@ void wivrn_session::reconnect()
U_LOG_E("Reconnection failed: %s", e.what());
}
}
xrt_result_t wivrn_session::get_roles(xrt_system_roles * out_roles)
{
std::lock_guard lock(roles_mutex);
*out_roles = roles;
return XRT_SUCCESS;
}
xrt_result_t wivrn_session::feature_inc(xrt_device_feature_type type)
{
if (type >= XRT_DEVICE_FEATURE_MAX_ENUM)
return XRT_ERROR_FEATURE_NOT_SUPPORTED;
// If it wasn't zero nothing to do.
if (!xrt_reference_inc_and_was_zero(&feature_use[type]))
return XRT_SUCCESS;
if (type == XRT_DEVICE_FEATURE_HAND_TRACKING_LEFT)
return xrt_device_begin_feature(static_roles.hand_tracking.left, type);
else if (type == XRT_DEVICE_FEATURE_HAND_TRACKING_RIGHT)
return xrt_device_begin_feature(static_roles.hand_tracking.right, type);
else if (type == XRT_DEVICE_FEATURE_EYE_TRACKING)
return xrt_device_begin_feature(static_roles.eyes, type);
return XRT_ERROR_FEATURE_NOT_SUPPORTED;
}
xrt_result_t wivrn_session::feature_dec(xrt_device_feature_type type)
{
if (type >= XRT_DEVICE_FEATURE_MAX_ENUM)
return XRT_ERROR_FEATURE_NOT_SUPPORTED;
// If it is not zero we are done.
if (!xrt_reference_dec_and_is_zero(&feature_use[type]))
return XRT_SUCCESS;
if (type == XRT_DEVICE_FEATURE_HAND_TRACKING_LEFT)
return xrt_device_end_feature(static_roles.hand_tracking.left, type);
else if (type == XRT_DEVICE_FEATURE_HAND_TRACKING_RIGHT)
return xrt_device_end_feature(static_roles.hand_tracking.right, type);
else if (type == XRT_DEVICE_FEATURE_EYE_TRACKING)
return xrt_device_end_feature(static_roles.eyes, type);
return XRT_ERROR_FEATURE_NOT_SUPPORTED;
}
} // namespace wivrn
+18 -5
View File
@@ -25,6 +25,7 @@
#include "wivrn_hmd.h"
#include "wivrn_packets.h"
#include "xrt/xrt_results.h"
#include "xrt/xrt_system.h"
#include <atomic>
#include <fstream>
#include <memory>
@@ -32,7 +33,6 @@
#include <thread>
struct u_system;
struct xrt_system_devices;
struct xrt_space_overseer;
struct xrt_system_compositor;
@@ -73,7 +73,7 @@ public:
void set_enabled(to_headset::tracking_control::id id, bool enabled);
};
class wivrn_session : public std::enable_shared_from_this<wivrn_session>
class wivrn_session : public xrt_system_devices
{
friend wivrn_comp_target_factory;
wivrn_connection connection;
@@ -82,8 +82,14 @@ class wivrn_session : public std::enable_shared_from_this<wivrn_session>
u_system & xrt_system;
xrt_space_overseer * space_overseer;
std::atomic<bool> quit = false;
std::thread thread;
std::mutex roles_mutex;
xrt_system_roles roles{
.generation_id = 1,
.left = -1,
.right = -1,
.gamepad = -1,
};
std::array<xrt_reference, XRT_DEVICE_FEATURE_MAX_ENUM> feature_use{};
wivrn_hmd hmd;
wivrn_controller left_hand;
@@ -104,6 +110,8 @@ class wivrn_session : public std::enable_shared_from_this<wivrn_session>
std::shared_ptr<audio_device> audio_handle;
std::jthread thread;
wivrn_session(TCP && tcp, u_system &);
public:
@@ -168,8 +176,13 @@ public:
void dump_time(const std::string & event, uint64_t frame, int64_t time, uint8_t stream = -1, const char * extra = "");
private:
static void run(std::weak_ptr<wivrn_session>);
void run(std::stop_token stop);
void reconnect();
// xrt_system implementation
xrt_result_t get_roles(xrt_system_roles * out_roles);
xrt_result_t feature_inc(xrt_device_feature_type type);
xrt_result_t feature_dec(xrt_device_feature_type type);
};
} // namespace wivrn