Use same packet definitions for both sockets

This commit is contained in:
Patrick Nicolas authored and Guillaume Meunier committed 2023-12-16 14:16:47 +01:00
1 parent 1792607ada
commit 94e60d4e8b
8 files changed
+9 -22

No files matched your search

-5
View File
@@ -18,16 +18,11 @@
*/
#include "lobby.h"
#include "glm/glm.hpp"
#include "render/text_rasterizer.h"
#include "stream.h"
#include "utils/ranges.h"
#include "utils/strings.h"
#include "vk/vk.h"
#include <cstdint>
#include <glm/gtc/quaternion.hpp>
#include <map>
#include <string>
#include <tiny_gltf.h>
-1
View File
@@ -23,7 +23,6 @@
#include "vk/buffer.h"
#include "vk/image.h"
#include "vk/renderpass.h"
#include "wivrn_client.h"
#include "wivrn_discover.h"
#include <tiny_gltf.h>
-5
View File
@@ -23,13 +23,8 @@
#include "scene.h"
#include "stream_reprojection.h"
#include "utils/sync_queue.h"
#include "vk/device_memory.h"
#include "vk/renderpass.h"
#include "wivrn_client.h"
#include "wivrn_packets.h"
#include <condition_variable>
#include <deque>
#include <functional>
#include <mutex>
#include <thread>
#include <vulkan/vulkan_core.h>
+2 -2
View File
@@ -27,8 +27,8 @@ using namespace xrt::drivers::wivrn;
class wivrn_session
{
typed_socket<TCP, to_headset::control_packets, from_headset::control_packets> control;
typed_socket<UDP, to_headset::stream_packets, from_headset::stream_packets> stream;
typed_socket<TCP, to_headset::packets, from_headset::packets> control;
typed_socket<UDP, to_headset::packets, from_headset::packets> stream;
void handshake();
+2 -4
View File
@@ -183,8 +183,7 @@ struct feedback
uint8_t received_data_packets;
};
using control_packets = std::variant<headset_info_packet, feedback, audio_data>;
using stream_packets = std::variant<handshake, tracking, inputs, timesync_response>;
using packets = std::variant<headset_info_packet, feedback, audio_data, handshake, tracking, inputs, timesync_response>;
} // namespace from_headset
namespace to_headset
@@ -288,8 +287,7 @@ struct timesync_query
std::chrono::nanoseconds query;
};
using control_packets = std::variant<handshake, audio_stream_description, video_stream_description, audio_data>;
using stream_packets = std::variant<video_stream_data_shard, haptics, timesync_query>;
using packets = std::variant<handshake, audio_stream_description, video_stream_description, audio_data, video_stream_data_shard, haptics, timesync_query>;
} // namespace to_headset
+1 -1
View File
@@ -98,7 +98,7 @@ wivrn_connection::wivrn_connection(TCP && tcp) :
}
}
std::optional<from_headset::control_packets> wivrn_connection::poll_control(int timeout)
std::optional<from_headset::packets> wivrn_connection::poll_control(int timeout)
{
pollfd fds{};
fds.events = POLLIN;
+3 -3
View File
@@ -28,8 +28,8 @@ using namespace xrt::drivers::wivrn;
class wivrn_connection
{
typed_socket<TCP, from_headset::control_packets, to_headset::control_packets> control;
typed_socket<UDP, from_headset::stream_packets, to_headset::stream_packets> stream;
typed_socket<TCP, from_headset::packets, to_headset::packets> control;
typed_socket<UDP, from_headset::packets, to_headset::packets> stream;
public:
wivrn_connection(TCP && tcp);
@@ -47,7 +47,7 @@ public:
stream.send(std::forward<T>(packet));
}
std::optional<from_headset::control_packets> poll_control(int timeout);
std::optional<from_headset::packets> poll_control(int timeout);
template <typename T>
int poll(T && visitor, int timeout)
+1 -1
View File
@@ -76,7 +76,7 @@ xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wi
xrt_system_compositor ** out_xsysc)
{
std::shared_ptr<wivrn_session> self;
std::optional<xrt::drivers::wivrn::from_headset::control_packets> control;
std::optional<xrt::drivers::wivrn::from_headset::packets> control;
try
{
self = std::shared_ptr<wivrn_session>(new wivrn_session(std::move(tcp)));