Fix client freeze when exiting

This commit is contained in:
Patrick Nicolas
2023-06-29 19:44:07 +02:00
parent 18f5b3a719
commit 20835c6e7f
6 changed files with 26 additions and 11 deletions
+9 -3
View File
@@ -128,8 +128,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
scenes::stream::~stream()
{
cleanup();
exiting = true;
shard_queue.close();
exit();
video_thread.join();
if (tracking_thread)
@@ -405,6 +404,13 @@ void scenes::stream::render()
read_actions();
}
void scenes::stream::exit()
{
exiting = true;
audio_handle.reset();
shard_queue.close();
}
void scenes::stream::cleanup()
{
// Assumes decoder_mutex is locked
@@ -556,7 +562,7 @@ void scenes::stream::video()
catch (std::exception & e)
{
spdlog::error("Exception in video thread: {}", e.what());
exiting = true;
exit();
}
}
}