Only send tracking once video stream is setup

This commit is contained in:
Patrick Nicolas
2022-11-12 11:44:52 +01:00
parent 3156881787
commit ae31d7727c
3 changed files with 9 additions and 5 deletions
+2 -4
View File
@@ -95,9 +95,6 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
self->network_thread = std::thread(&stream::process_packets, self.get());
pthread_setname_np(self->network_thread.native_handle(), "network_thread");
self->tracking_thread = std::thread(&stream::tracking, self.get());
pthread_setname_np(self->tracking_thread.native_handle(), "tracking_thread");
self->video_thread = std::thread(&stream::video, self.get());
pthread_setname_np(self->video_thread.native_handle(), "video_thread");
@@ -132,7 +129,8 @@ scenes::stream::~stream()
shard_queue.close();
video_thread.join();
tracking_thread.join();
if (tracking_thread)
tracking_thread->join();
network_thread.join();
}
+1 -1
View File
@@ -65,7 +65,7 @@ class stream : public scene, public std::enable_shared_from_this<stream>
std::unique_ptr<wivrn_session> network_session;
std::atomic<bool> exiting = false;
std::thread network_thread;
std::thread tracking_thread;
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;
+6
View File
@@ -52,6 +52,12 @@ void scenes::stream::operator()(to_headset::video_stream_parity_shard && shard)
void scenes::stream::operator()(to_headset::video_stream_description && desc)
{
setup(desc);
if (not tracking_thread)
{
tracking_thread = std::thread(&stream::tracking, this);
pthread_setname_np(tracking_thread->native_handle(), "tracking_thread");
}
}
void scenes::stream::operator()(to_headset::timesync_query && query)