Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "video_encoder.h"
|
||||
|
||||
#include "wivrn_packets.h"
|
||||
#include <charconv>
|
||||
#include <cmath>
|
||||
#include <magic_enum.hpp>
|
||||
#include <string>
|
||||
@@ -307,34 +308,22 @@ static std::vector<configuration::encoder> get_encoder_default_settings(wivrn_vk
|
||||
#ifdef WIVRN_SPLIT_ENCODERS
|
||||
if (base.name != encoder_x264)
|
||||
{
|
||||
/* Split in 3 parts:
|
||||
/* Split in 2 parts:
|
||||
* +--------+--------+
|
||||
* | | |
|
||||
* | | |
|
||||
* +--------+ |
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
* | left | right |
|
||||
* | eye | eye |
|
||||
* | | |
|
||||
* +--------+--------+
|
||||
* All 3 are encoded sequentially, so that the smallest is ready earlier.
|
||||
* Encoded sequentially, so the first eye is ready and transmitted earlier.
|
||||
* Decoder can start work as fast as possible, reducing idle time.
|
||||
* Splitting on eye boundaries allows for fast-path on headset.
|
||||
*
|
||||
*/
|
||||
return {
|
||||
{
|
||||
.name = base.name,
|
||||
.width = 0.5,
|
||||
.height = 0.25,
|
||||
.group = 0,
|
||||
.codec = base.codec,
|
||||
},
|
||||
{
|
||||
.name = base.name,
|
||||
.width = 0.5,
|
||||
.height = 0.75,
|
||||
.offset_y = 0.25,
|
||||
.group = 0,
|
||||
.codec = base.codec,
|
||||
},
|
||||
|
||||
@@ -331,13 +331,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());
|
||||
}
|
||||
|
||||
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;
|
||||
auto begin = data.begin();
|
||||
auto end = data.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)));
|
||||
auto next = std::min(end, begin + max_payload_size);
|
||||
const size_t payload_size = std::max(0z, max_payload_size - ssize_t(serialized_size(shard.view_info)));
|
||||
auto next = std::min(end, begin + payload_size);
|
||||
if (next == end)
|
||||
{
|
||||
shard.flags |= to_headset::video_stream_data_shard::end_of_slice;
|
||||
|
||||
Reference in New Issue
Block a user