Reduce some copies in serialization

Also update a bunch of stuff
This commit is contained in:
Patrick Nicolas
2023-11-22 00:00:55 +01:00
parent c799fa6aa4
commit 8b0895913b
22 changed files with 805 additions and 820 deletions
+7 -11
View File
@@ -543,17 +543,13 @@ void scenes::stream::video()
{
auto shard = shard_queue.pop();
std::visit(
[this](auto & shard) {
if (shard.stream_item_idx >= decoders.size())
{
// We don't know (yet?) about this stream, ignore packet
return;
}
auto idx = shard.stream_item_idx;
decoders[idx].decoder->push_shard(std::move(shard));
},
shard);
if (shard.stream_item_idx >= decoders.size())
{
// We don't know (yet?) about this stream, ignore packet
return;
}
auto idx = shard.stream_item_idx;
decoders[idx].decoder->push_shard(std::move(shard));
}
catch (utils::sync_queue_closed &)
{
+1 -2
View File
@@ -69,7 +69,7 @@ class stream : public scene, public std::enable_shared_from_this<stream>
std::optional<std::thread> tracking_thread;
std::thread video_thread;
utils::sync_queue<std::variant<to_headset::video_stream_data_shard, to_headset::video_stream_parity_shard>> shard_queue;
utils::sync_queue<to_headset::video_stream_data_shard> shard_queue;
std::mutex decoder_mutex;
std::vector<accumulator_images> decoders; // Locked by decoder_mutex
@@ -102,7 +102,6 @@ public:
void operator()(to_headset::handshake&&) {};
void operator()(to_headset::video_stream_data_shard &&);
void operator()(to_headset::video_stream_parity_shard &&);
void operator()(to_headset::haptics &&);
void operator()(to_headset::timesync_query &&);
void operator()(to_headset::audio_stream_description &&);
-6
View File
@@ -43,12 +43,6 @@ void scenes::stream::operator()(to_headset::video_stream_data_shard && shard)
shard_queue.push(std::move(shard));
}
void scenes::stream::operator()(to_headset::video_stream_parity_shard && shard)
{
video_started_ = true;
shard_queue.push(std::move(shard));
}
void scenes::stream::operator()(to_headset::audio_stream_description && desc)
{
audio_handle.emplace(desc, *network_session, instance);