Don't shard when using TCP
This commit is contained in:
@@ -64,6 +64,11 @@ public:
|
|||||||
wivrn_connection(const wivrn_connection &) = delete;
|
wivrn_connection(const wivrn_connection &) = delete;
|
||||||
wivrn_connection & operator=(const wivrn_connection &) = delete;
|
wivrn_connection & operator=(const wivrn_connection &) = delete;
|
||||||
|
|
||||||
|
bool has_stream() const
|
||||||
|
{
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_active()
|
bool is_active()
|
||||||
{
|
{
|
||||||
return active;
|
return active;
|
||||||
|
|||||||
@@ -193,6 +193,10 @@ public:
|
|||||||
void operator()(to_monado::disconnect &&);
|
void operator()(to_monado::disconnect &&);
|
||||||
void operator()(to_monado::set_bitrate &&);
|
void operator()(to_monado::set_bitrate &&);
|
||||||
|
|
||||||
|
bool has_stream()
|
||||||
|
{
|
||||||
|
return connection->has_stream();
|
||||||
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void send_stream(T && packet)
|
void send_stream(T && packet)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -305,13 +305,15 @@ void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame, bool co
|
|||||||
timing_info.send_begin = clock.to_headset(os_monotonic_get_ns());
|
timing_info.send_begin = clock.to_headset(os_monotonic_get_ns());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t max_payload_size = cnx->has_stream() ? to_headset::video_stream_data_shard::max_payload_size : std::numeric_limits<uint32_t>::max();
|
||||||
|
|
||||||
shard.flags = to_headset::video_stream_data_shard::start_of_slice;
|
shard.flags = to_headset::video_stream_data_shard::start_of_slice;
|
||||||
auto begin = data.begin();
|
auto begin = data.begin();
|
||||||
auto end = data.end();
|
auto end = data.end();
|
||||||
while (begin != end)
|
while (begin != end)
|
||||||
{
|
{
|
||||||
const size_t max_payload_size = std::max(0z, ssize_t(to_headset::video_stream_data_shard::max_payload_size) - ssize_t(serialized_size(shard.view_info)));
|
const size_t payload_size = std::max(0z, max_payload_size - ssize_t(serialized_size(shard.view_info)));
|
||||||
auto next = std::min(end, begin + max_payload_size);
|
auto next = std::min(end, begin + payload_size);
|
||||||
if (next == end)
|
if (next == end)
|
||||||
{
|
{
|
||||||
shard.flags |= to_headset::video_stream_data_shard::end_of_slice;
|
shard.flags |= to_headset::video_stream_data_shard::end_of_slice;
|
||||||
|
|||||||
Reference in New Issue
Block a user