clang-format
This commit is contained in:
@@ -36,7 +36,8 @@
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
wivrn_session::wivrn_session(in6_addr address, int port) : control(address, port), stream()
|
||||
wivrn_session::wivrn_session(in6_addr address, int port) :
|
||||
control(address, port), stream()
|
||||
{
|
||||
// TODO: negociate UDP port
|
||||
stream.bind(stream_client_port);
|
||||
@@ -47,7 +48,8 @@ wivrn_session::wivrn_session(in6_addr address, int port) : control(address, port
|
||||
spdlog::info("Connection to {}:{}", inet_ntop(AF_INET6, &address, buffer, sizeof(buffer)), port);
|
||||
}
|
||||
|
||||
wivrn_session::wivrn_session(in_addr address, int port) : control(address, port), stream()
|
||||
wivrn_session::wivrn_session(in_addr address, int port) :
|
||||
control(address, port), stream()
|
||||
{
|
||||
// TODO: negociate UDP port
|
||||
stream.bind(stream_client_port);
|
||||
|
||||
@@ -345,7 +345,7 @@ public:
|
||||
|
||||
log_query(record, service_name);
|
||||
std::array<uint8_t, 2048> buffer;
|
||||
for(size_t i = 1; i < pollfds.size(); i++)
|
||||
for (size_t i = 1; i < pollfds.size(); i++)
|
||||
{
|
||||
if (mdns_query_send(pollfds[i].fd, record, service_name.data(), service_name.size(), buffer.data(), buffer.size(), 0))
|
||||
{
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
::read(pollfds[0].fd, buffer.data(), buffer.size());
|
||||
}
|
||||
|
||||
for(size_t i = 1; i < pollfds.size(); i++)
|
||||
for (size_t i = 1; i < pollfds.size(); i++)
|
||||
{
|
||||
if (pollfds[i].revents & POLLIN)
|
||||
{
|
||||
@@ -504,7 +504,8 @@ void wivrn_discover::discover(std::string service_name)
|
||||
}
|
||||
}
|
||||
|
||||
wivrn_discover::wivrn_discover(std::string service_name) : cache(std::make_unique<dnssd_cache>()), dnssd_thread(&wivrn_discover::discover, this, service_name)
|
||||
wivrn_discover::wivrn_discover(std::string service_name) :
|
||||
cache(std::make_unique<dnssd_cache>()), dnssd_thread(&wivrn_discover::discover, this, service_name)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -534,20 +535,21 @@ int main()
|
||||
{
|
||||
wivrn_discover wd("_wivrn._tcp.local.");
|
||||
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
auto now = steady_clock::now();
|
||||
auto services = wd.get_services();
|
||||
|
||||
spdlog::info("{} service(s) found", services.size());
|
||||
for(auto& i: services)
|
||||
for (auto & i: services)
|
||||
{
|
||||
spdlog::info(" {} at {}:{}, expires in {} s", i.name, i.hostname, i.port, duration_cast<seconds>(i.ttl - now).count());
|
||||
for(auto& j: i.addresses)
|
||||
for (auto & j: i.addresses)
|
||||
{
|
||||
std::visit([](const auto& addr){
|
||||
std::visit([](const auto & addr) {
|
||||
spdlog::info(" {}", ip_address_to_string(addr));
|
||||
}, j);
|
||||
},
|
||||
j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <netinet/in.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
|
||||
class dnssd_cache;
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ struct video_stream_description
|
||||
uint16_t offset_x;
|
||||
uint16_t offset_y;
|
||||
video_codec codec;
|
||||
std::optional<uint32_t> range; // VkSamplerYcbcrRange
|
||||
std::optional<uint32_t> range; // VkSamplerYcbcrRange
|
||||
std::optional<uint32_t> color_model; // VkSamplerYcbcrModelConversion
|
||||
};
|
||||
struct foveation_parameter_item
|
||||
@@ -213,8 +213,8 @@ class video_stream_data_shard
|
||||
{
|
||||
std::shared_ptr<std::vector<uint8_t>> data;
|
||||
friend serialization_traits<video_stream_data_shard, void>;
|
||||
public:
|
||||
|
||||
public:
|
||||
inline static const size_t max_payload_size = 1400;
|
||||
enum flags : uint8_t
|
||||
{
|
||||
@@ -289,7 +289,7 @@ struct serialization_traits<to_headset::video_stream_data_shard, void>
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void serialize(const to_headset::video_stream_data_shard& shard, T& packet)
|
||||
static void serialize(const to_headset::video_stream_data_shard & shard, T & packet)
|
||||
{
|
||||
packet.serialize(shard.stream_item_idx);
|
||||
packet.serialize(shard.frame_idx);
|
||||
@@ -302,7 +302,7 @@ struct serialization_traits<to_headset::video_stream_data_shard, void>
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static to_headset::video_stream_data_shard deserialize(T& packet)
|
||||
static to_headset::video_stream_data_shard deserialize(T & packet)
|
||||
{
|
||||
to_headset::video_stream_data_shard shard;
|
||||
packet.deserialize(shard.stream_item_idx);
|
||||
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void deserialize(T& v)
|
||||
void deserialize(T & v)
|
||||
{
|
||||
v = deserialize<T>();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
#include "encoder_settings.h"
|
||||
#include "configuration.h"
|
||||
#include "video_encoder.h"
|
||||
#include "vk/vk_helpers.h"
|
||||
#include "configuration.h"
|
||||
|
||||
#include <string>
|
||||
#include <vulkan/vulkan.h>
|
||||
@@ -90,7 +90,7 @@ std::vector<encoder_settings> xrt::drivers::wivrn::get_encoder_settings(vk_bundl
|
||||
return get_encoder_default_settings(vk, width, height);
|
||||
std::vector<xrt::drivers::wivrn::encoder_settings> res;
|
||||
int next_group = 0;
|
||||
for (const auto& encoder: config.encoders)
|
||||
for (const auto & encoder: config.encoders)
|
||||
{
|
||||
xrt::drivers::wivrn::encoder_settings settings{};
|
||||
settings.encoder_name = encoder.name;
|
||||
|
||||
@@ -126,8 +126,7 @@ VideoEncoderVA::VideoEncoderVA(vk_bundle * vk, const encoder_settings & settings
|
||||
int err = av_hwdevice_ctx_create(&tmp, AV_HWDEVICE_TYPE_VAAPI, device ? device->c_str() : NULL, NULL, 0);
|
||||
if (err < 0)
|
||||
{
|
||||
throw std::system_error(err, av_error_category(), "Failed create VAAPI device" +
|
||||
(device ? (" " + device->string()) : std::string()));
|
||||
throw std::system_error(err, av_error_category(), "Failed create VAAPI device" + (device ? (" " + device->string()) : std::string()));
|
||||
}
|
||||
hw_ctx_vaapi.reset(tmp);
|
||||
|
||||
|
||||
@@ -192,7 +192,9 @@ void VideoEncoder::PushShard(std::vector<uint8_t> && payload, uint8_t flags)
|
||||
if (not shards.empty())
|
||||
{
|
||||
cnx->send_stream(shards.back());
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cnx->dump_time("send_start", frame_idx, os_monotonic_get_ns(), stream_idx);
|
||||
}
|
||||
to_headset::video_stream_data_shard shard;
|
||||
|
||||
@@ -46,7 +46,8 @@ xrt_system_devices * xrt::drivers::wivrn::wivrn_session::create_session(xrt::dri
|
||||
try
|
||||
{
|
||||
self = std::shared_ptr<wivrn_session>(new wivrn_session(std::move(tcp), address.sin6_addr));
|
||||
while (not (control = self->connection.poll_control(-1))) {}
|
||||
while (not(control = self->connection.poll_control(-1)))
|
||||
{}
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -131,7 +132,6 @@ void wivrn_session::operator()(from_headset::timesync_response && timesync)
|
||||
|
||||
void wivrn_session::operator()(from_headset::feedback && feedback)
|
||||
{
|
||||
|
||||
clock_offset o;
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
@@ -207,7 +207,7 @@ std::array<to_headset::video_stream_description::foveation_parameter, 2> wivrn_s
|
||||
return hmd->get_foveation_parameters();
|
||||
}
|
||||
|
||||
void wivrn_session::dump_time(const std::string &event, uint64_t frame, uint64_t time, uint8_t stream)
|
||||
void wivrn_session::dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream)
|
||||
{
|
||||
if (feedback_csv)
|
||||
{
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
std::array<to_headset::video_stream_description::foveation_parameter, 2> get_foveation_parameters();
|
||||
|
||||
void dump_time(const std::string& event, uint64_t frame, uint64_t time, uint8_t stream = -1);
|
||||
void dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream = -1);
|
||||
|
||||
private:
|
||||
static void run(std::weak_ptr<wivrn_session>);
|
||||
|
||||
Reference in New Issue
Block a user